Skip to content

Commit

Permalink
Added alias command for backing up artist IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalec committed Mar 12, 2022
1 parent 4e347ef commit c758571
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions deemon/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,15 @@ def show_command():
@click.option('-f', '--filter', type=str, help='Specify filter for CSV output')
@click.option('-H', '--hide-header', is_flag=True, help='Hide header on CSV output')
@click.option('-i', '--artist-id', is_flag=True, help='Show artist info by artist ID')
def show_artists(artist, artist_id, csv, export, filter, hide_header):
@click.option('-b', '--backup', type=Path, help='Backup artist IDs to CSV, same as -cHf id -e ...')
def show_artists(artist, artist_id, csv, export, filter, hide_header, backup):
"""Show artist info monitored by profile"""
if artist:
artist = ' '.join([x for x in artist])

show = Show()
show.monitoring(artist=True, query=artist, export_csv=csv, save_path=export, filter=filter, hide_header=hide_header,
is_id=artist_id)
is_id=artist_id, backup=backup)


@show_command.command(name="playlists")
Expand Down
8 changes: 7 additions & 1 deletion deemon/cmd/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self):

def monitoring(self, artist: bool = True, query: str = None, export_csv: bool = False,
save_path: Union[str, Path] = None, filter: str = None, hide_header: bool = False,
is_id: bool = False):
is_id: bool = False, backup: Union[str, Path] = None):

def csv_output(line: str):
if save_path:
Expand All @@ -28,6 +28,12 @@ def csv_output(line: str):

output_to_file = []

if backup:
export_csv = True
filter = "id"
hide_header = True
save_path = backup

if artist:
if query:
if is_id:
Expand Down

0 comments on commit c758571

Please sign in to comment.