track_number returns 1, PlaylistMeta data now contains playlist_count, and added tmp and vs folders to .gitignore

This commit is contained in:
Frank 2022-04-29 18:42:16 -04:00
parent e3c4e05f44
commit d116818172
4 changed files with 10 additions and 7 deletions

5
.gitignore vendored
View file

@ -6,6 +6,11 @@ __pycache__/
# C extensions # C extensions
*.so *.so
# VSCODE files
.vscode
# Build files
tmp/
# Distribution / packaging # Distribution / packaging
.Python .Python
build/ build/

View file

@ -14,6 +14,7 @@ class PlaylistMetadata:
playlist_index: int playlist_index: int
playlist_id: str playlist_id: str
playlist_extractor: str playlist_extractor: str
playlist_count: int
class BaseEntry(ABC): class BaseEntry(ABC):

View file

@ -31,7 +31,6 @@ class SoundcloudAlbumTrack(SoundcloudTrack):
working_directory: str, working_directory: str,
album: str, album: str,
album_year: int, album_year: int,
total_tracks: int,
playlist_metadata: PlaylistMetadata, playlist_metadata: PlaylistMetadata,
): ):
""" """
@ -41,7 +40,6 @@ class SoundcloudAlbumTrack(SoundcloudTrack):
self._album = album self._album = album
self._album_year = album_year self._album_year = album_year
self._playlist_metadata = playlist_metadata self._playlist_metadata = playlist_metadata
self._total_tracks = total_tracks
@property @property
def track_number(self) -> int: def track_number(self) -> int:
@ -56,7 +54,7 @@ class SoundcloudAlbumTrack(SoundcloudTrack):
@property @property
def total_tracks(self) -> int: def total_tracks(self) -> int:
"""Returns the entry's total tracks in album for singles this is 1, fetched from its internal album""" """Returns the entry's total tracks in album for singles this is 1, fetched from its internal album"""
return self._total_tracks return self._playlist_metadata.playlist_count
@property @property
def album_year(self) -> int: def album_year(self) -> int:
@ -116,7 +114,8 @@ class SoundcloudAlbum(Entry):
playlist_metadata=PlaylistMetadata( playlist_metadata=PlaylistMetadata(
playlist_id=self.uid, playlist_id=self.uid,
playlist_extractor=self.extractor, playlist_extractor=self.extractor,
playlist_index=track.kwargs("playlist_index"), playlist_index= track.kwargs("playlist_index"),
playlist_count = self.track_count
), ),
) )
for track in tracks for track in tracks

View file

@ -32,9 +32,7 @@ class SoundcloudVariables(EntryVariables):
------- -------
The total tracks in album. For singles, it will always be 1. The total tracks in album. For singles, it will always be 1.
""" """
if self.kwargs_contains("total_tracks"): return 1
return self.kwargs("total_tracks")
return 1 # i.e. single does not contain total_tracks
@property @property
def album(self) -> str: def album(self) -> str: