PromyLOPh / pianobar

Console-based pandora.com player
http://6xq.net/pianobar/
Other
1.74k stars 320 forks source link

Ability for the User to enter 'da' for downloading the songs? Too much to ask for? #752

Closed maiteemate closed 4 months ago

maiteemate commented 4 months ago

Subject of the issue

As a user of Pianobar, I want to see an option for the User, when they type 'da' command while a song is playing, that the ability to automatically 'download' or 'save' the current playing song is made available.

The way I imagine you could accomplish this is via the 'lame' encoder for converting the audio to MP3.

sudo apt-get install lame (should take care of it)

You could update the code to something like this...

FILE *outfile = NULL; pthread_mutex_t lock; int download_audio = 0;

void open_output_file() { outfile = popen("lame -r -s 44.1 - output.mp3", "w"); if (!outfile) { perror("popen"); exit(EXIT_FAILURE); } }


void handle_command(const char *cmd) { if (strcmp(cmd, "da") == 0) { pthread_mutex_lock(&lock); download_audio = 1; open_output_file(); pthread_mutex_unlock(&lock); } else if (strcmp(cmd, "stopda") == 0) { pthread_mutex_lock(&lock); download_audio = 0; close_output_file(); pthread_mutex_unlock(&lock); } }

Your environment

Expected behavior

User should be able to set a location of where the Songs can be downloaded. Once there is an option for 'da' songs, it should also be available under the /help or '?' menu.

Actual behavior

The current functionality does NOT appear in the program.

Please let me know if you need additional info. or updated code, since I have NOT yet run this in my environment, but I imagine you used C or C# to build this program out. You could also update the 'Keybindings' for 'act_download' = da or something like it, so becomes available in the config. or the HELP (?) section of the program, as an option.

Hope this can be achieved. If not, at least I tried asking. Thank you for this already awesome program.

Cheers

PromyLOPh commented 4 months ago

The Windows port is maintained here: https://github.com/thedmd/pianobar-windows

Downloading songs will not be an official feature of pianobar for obvious reasons.