Skip to content

Commit

Permalink
v0.3.0
Browse files Browse the repository at this point in the history
Minor version release.  Libraries changed from youtube-dl to pytube for convenience and speed.
  • Loading branch information
github-actions[bot] committed May 27, 2021
1 parent 60b9782 commit 4072b63
Show file tree
Hide file tree
Showing 12 changed files with 1,060 additions and 1,327 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@
Changelog
*********

v0.3.0
========================================

- more improvements to release automation.
- Added exception handling to _get_youtube_player
- Prevent CHANGELOG entries for "Merge branch 'master'" commits.
- Fix typo in release.yml
- Update release.yml to skip PYPI upload if there is no token and to use default GH token
- Add GitHub Actions yaml for automating releases.
- Add missing linefeed.
- Merge branch 'master' of https://github.com/OzymandiasTheGreat/mopidy-ytmusic
- switch descramble routines from youtube-dl to pytube
- Merge branch 'master' of github.com:OzymandiasTheGreat/mopidy-ytmusic
- Merge branch 'master' of github.com:OzymandiasTheGreat/mopidy-ytmusic
- Merge branch 'master' of github.com:OzymandiasTheGreat/mopidy-ytmusic
- Merge branch 'master' of github.com:OzymandiasTheGreat/mopidy-ytmusic
- Merge branch 'master' of github.com:OzymandiasTheGreat/mopidy-ytmusic
- - Version bump

v0.2.4
========================================

Expand Down
1 change: 0 additions & 1 deletion mopidy_ytmusic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import pathlib

import pkg_resources

from mopidy import config, ext

__version__ = pkg_resources.get_distribution("Mopidy-YTMusic").version
Expand Down
31 changes: 16 additions & 15 deletions mopidy_ytmusic/backend.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
import pykka
import requests
import re
import hashlib
import random
import re
import time
import hashlib

import pykka
import requests
from mopidy import backend
from mopidy_ytmusic import logger
from ytmusicapi.ytmusic import YTMusic
from ytmusicapi.parsers.utils import (
nav,
get_continuations,
CAROUSEL_TITLE,
TITLE,
TITLE_TEXT,
NAVIGATION_BROWSE_ID,
SINGLE_COLUMN_TAB,
SECTION_LIST,
SINGLE_COLUMN_TAB,
TITLE,
TITLE_TEXT,
get_continuations,
nav,
)
from ytmusicapi.ytmusic import YTMusic

from mopidy_ytmusic import logger

from .repeating_timer import RepeatingTimer
from .scrobble_fe import YTMusicScrobbleListener
from .playback import YTMusicPlaybackProvider
from .library import YTMusicLibraryProvider
from .playback import YTMusicPlaybackProvider
from .playlist import YTMusicPlaylistsProvider
from .repeating_timer import RepeatingTimer
from .scrobble_fe import YTMusicScrobbleListener


class YTMusicBackend(
Expand Down Expand Up @@ -101,7 +102,7 @@ def _refresh_youtube_player(self):

def _get_youtube_player(self):
# Refresh our js player URL so YDL can decode the signature correctly.
try:
try:
response = requests.get(
"https://music.youtube.com",
headers=self.api.headers,
Expand Down
4 changes: 3 additions & 1 deletion mopidy_ytmusic/command.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from pathlib import Path
import os
from pathlib import Path

from mopidy import commands

from mopidy_ytmusic import logger


Expand Down
11 changes: 6 additions & 5 deletions mopidy_ytmusic/library.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from mopidy import backend
from mopidy.models import Ref, Track, Album, Artist, SearchResult, Image
from mopidy_ytmusic import logger
from mopidy.models import Album, Artist, Image, Ref, SearchResult, Track
from ytmusicapi.parsers.utils import (
nav,
TITLE_TEXT,
NAVIGATION_BROWSE_ID,
SINGLE_COLUMN_TAB,
SECTION_LIST,
SINGLE_COLUMN_TAB,
TITLE_TEXT,
nav,
)

from mopidy_ytmusic import logger


class YTMusicLibraryProvider(backend.LibraryProvider):
root_directory = Ref.directory(uri="ytmusic:root", name="YouTube Music")
Expand Down
15 changes: 11 additions & 4 deletions mopidy_ytmusic/playback.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import requests
import re
from urllib.parse import parse_qs

import requests
from mopidy import backend
from mopidy_ytmusic import logger
from pytube.cipher import Cipher

from mopidy_ytmusic import logger


class YTMusicPlaybackProvider(backend.PlaybackProvider):
def __init__(self, *args, **kwargs):
Expand All @@ -21,7 +23,10 @@ def update_cipher(self, playerurl):
if m:
self.signatureTimestamp = m.group(1)
self.PyTubeCipher = Cipher(js=response.text)
logger.debug("YTMusic updated signatureTimestamp to %s", self.signatureTimestamp)
logger.debug(
"YTMusic updated signatureTimestamp to %s",
self.signatureTimestamp,
)
else:
logger.error("YTMusic unable to extract signatureTimestamp.")
return None
Expand Down Expand Up @@ -138,7 +143,9 @@ def _get_track(self, bId):
# Use Youtube-DL's Info Extractor to decode the signature.
if "signatureCipher" in playstr:
sc = parse_qs(playstr["signatureCipher"])
sig = self.PyTubeCipher.get_signature(ciphered_signature=sc["s"][0])
sig = self.PyTubeCipher.get_signature(
ciphered_signature=sc["s"][0]
)
url = sc["url"][0] + "&sig=" + sig + "&ratebypass=yes"
elif "url" in playstr:
url = playstr["url"]
Expand Down
3 changes: 2 additions & 1 deletion mopidy_ytmusic/playlist.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from mopidy import backend
from mopidy.models import Playlist, Ref

from mopidy_ytmusic import logger
from mopidy.models import Ref, Playlist


class YTMusicPlaylistsProvider(backend.PlaylistsProvider):
Expand Down
2 changes: 1 addition & 1 deletion mopidy_ytmusic/scrobble_fe.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Stolen almost directly from mopidy-gmusic
import pykka

from mopidy import core, listener

from mopidy_ytmusic import logger


Expand Down
Loading

0 comments on commit 4072b63

Please sign in to comment.