track_number returns 1, PlaylistMeta data now contains playlist_count, and added tmp and vs folders to .gitignore
This commit is contained in:
parent
e3c4e05f44
commit
d116818172
4 changed files with 10 additions and 7 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -6,6 +6,11 @@ __pycache__/
|
|||
# C extensions
|
||||
*.so
|
||||
|
||||
# VSCODE files
|
||||
.vscode
|
||||
# Build files
|
||||
tmp/
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class PlaylistMetadata:
|
|||
playlist_index: int
|
||||
playlist_id: str
|
||||
playlist_extractor: str
|
||||
playlist_count: int
|
||||
|
||||
|
||||
class BaseEntry(ABC):
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ class SoundcloudAlbumTrack(SoundcloudTrack):
|
|||
working_directory: str,
|
||||
album: str,
|
||||
album_year: int,
|
||||
total_tracks: int,
|
||||
playlist_metadata: PlaylistMetadata,
|
||||
):
|
||||
"""
|
||||
|
|
@ -41,7 +40,6 @@ class SoundcloudAlbumTrack(SoundcloudTrack):
|
|||
self._album = album
|
||||
self._album_year = album_year
|
||||
self._playlist_metadata = playlist_metadata
|
||||
self._total_tracks = total_tracks
|
||||
|
||||
@property
|
||||
def track_number(self) -> int:
|
||||
|
|
@ -56,7 +54,7 @@ class SoundcloudAlbumTrack(SoundcloudTrack):
|
|||
@property
|
||||
def total_tracks(self) -> int:
|
||||
"""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
|
||||
def album_year(self) -> int:
|
||||
|
|
@ -116,7 +114,8 @@ class SoundcloudAlbum(Entry):
|
|||
playlist_metadata=PlaylistMetadata(
|
||||
playlist_id=self.uid,
|
||||
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
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@ class SoundcloudVariables(EntryVariables):
|
|||
-------
|
||||
The total tracks in album. For singles, it will always be 1.
|
||||
"""
|
||||
if self.kwargs_contains("total_tracks"):
|
||||
return self.kwargs("total_tracks")
|
||||
return 1 # i.e. single does not contain total_tracks
|
||||
return 1
|
||||
|
||||
@property
|
||||
def album(self) -> str:
|
||||
|
|
|
|||
Loading…
Reference in a new issue