Skip to content

Commit

Permalink
Merge pull request #77 from Krutyi-4el/develop
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
solaluset authored Nov 18, 2023
2 parents e9c6fcc + d9b55ec commit d34243f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 5 additions & 4 deletions musicbot/audiocontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ async def play_song(self, song: Song):
before_options="-reconnect 1 -reconnect_streamed 1"
" -reconnect_delay_max 5",
options="-loglevel error",
stderr=sys.stderr,
),
after=self.next_song,
)
Expand All @@ -351,16 +352,16 @@ async def process_song(self, track: str) -> Optional[Song]:
Starts playing if it is the first song"""

loaded_song = await loader.load_song(track)
if isinstance(loaded_song, Song):
if not loaded_song:
return None
elif isinstance(loaded_song, Song):
self.playlist.add(loaded_song)
elif isinstance(loaded_song, list):
else:
for song in loaded_song:
self.playlist.add(song)
loaded_song = Song(
linkutils.Origins.Playlist, linkutils.Sites.Unknown
)
else:
return None

if self.current_song is None:
print("Playing {}".format(track))
Expand Down
4 changes: 3 additions & 1 deletion musicbot/linkutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ async def get_spotify_playlist(url: str) -> list:
)

async with aiohttp.ClientSession(headers=headers) as session:
async with session.get(url + "&nd=1") as response:
if "?si=" in url:
url += "&nd=1"
async with session.get(url) as response:
page = await response.text()

soup = BeautifulSoup(page, "html.parser")
Expand Down

0 comments on commit d34243f

Please sign in to comment.