Results 1 to 7 of 7

Thread: ....cool way to record your fave radio station for your mp3 player with wget ...

  1. #1
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan Norwich
    Beans
    2,326
    Distro
    Lubuntu 22.04 Jammy Jellyfish

    ....cool way to record your fave radio station for your mp3 player with wget ...

    now summer is upon us in the Northern hemisphere some of us dare to go places and sit out in the sunshine. Now if you want your radio station but do not want to be on your mobile data and get you head b(l)asted with microwave (call me old-fashioned) it is a nice trick to store one-hour segments of your fave station and keep those on your mp3 player; then no microwave, no cost and musical enjoyment guaranteed ...

    For years i have used this [example:]

    cvlc --run-time=3600 http://www.radioking.com/play/radio-planeta-occitania --sout "#duplicate{dst=std{access=file,mux=raw,dst=$H OME/Desktop/ Radio Planèta Occitània ♪♪ -$(date "+%a %F [%T]").mp3}" vlc://quit
    always in my view a tad unwieldy and problems arise with some formats; so reading around found there is an EASIER route much easier using wget (some of you prob know this already) but I am convinced many do not; and it is really easier

    I want this to be able to use a timer; maybe also to start at a given time; and to retain all data regarding time of recording in filename so this is what I came up with. May be of use to others and some might comment on improvements :]

    sleep 10m 30s && timeout 3600 wget http://www.rootslegacy.fr:8080/ -O "Music/♪♪-$(date "+%a %F [%T]") Roots Legacy.mp3"
    sleep lets you start when you choose in the future s seconds m minutes etc
    timeout lets you manage duration in seconds here
    wget + url then an extended set of time info; filling all requirements stated

    Of course change red sections for your needs


    NB: your mp3 player or say Foobar might groan with ♪♪ or [%T] as it produces ":" so maybe omit but every player is different so keep or omit ... Foobar under wine cannot abide ":" for example. Audacious is very happy with this ...
    Last edited by shantiq; June 15th, 2021 at 09:14 AM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community ie 50 brains are better than one
    Playing with Slackware too now ...
    ShanArt

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: ....cool way to record your fave radio station for your mp3 player with wget ...

    wget completely rocks!
    timeout is very handy! It accepts 1h or 60m as duration times, BTW. No need to think only in seconds.
    So ... we can use sleep and that's fine, but what if we'd like to setup daily recordings or weekly recordings that always happen?
    We can use cron or at for those.

    I don't record audio, but do record TV using a script that accepts the channel, duration and a filename/title. Then just ask 'at' to run it 'at' sometime in the future. For example:
    Code:
    echo "tv-record.sh 5.4 124 The_Organization-1971" | at 02:58 fri
    This will record channel 5.4 for ~2 hrs, creating a The_Organization-1971-$(date "+%F-%T").ts file. It will start a little before 3am Friday. The timestamp prevents using NTFS or Samba storage, which I see as a bonus. Stay native storage.

    There are many ways to skin this problem. Sometimes the first tuner is busy on my LAN, so I need to check the return code value from it to know whether trying a 2nd or 3rd tuner would help. The timeout command has a --preserve-status option which will pass on the result from wget. Check $? for the returned value from the last command, if needed.

    When scripting things, it is best to use the full-path to any programs so a limited environment won't fail over that.

    Also, avoid spaces in any filenames. Later scripts won't work as easily if there are spaces. It is handy to feed 108 files into another script, which will use a space as a filename delimiter to process each file in turn.
    Code:
    #!/bin/bash
    for filename in "$@"; do
       echo "Working on $filename .... "
    .... do something kewl to each input file .... 
    done
    Run it with ./script *mp3
    Filenames with spaces break that pattern. Won't work.

  3. #3
    Join Date
    Jun 2021
    Beans
    1

    Cool Re: ....cool way to record your fave radio station for your mp3 player with wget ...

    thank you!

  4. #4
    Join Date
    Jul 2021
    Beans
    1

    Re: ....cool way to record your fave radio station for your mp3 player with wget ...

    thanks for this, i'll try this

  5. #5
    Join Date
    Jul 2021
    Beans
    1

    Re: ....cool way to record your fave radio station for your mp3 player with wget ...

    Thanks for sharing, it's great I will try your way.
    Listen to online radio here: internetradio hören
    Last edited by griseldalani; July 18th, 2021 at 02:35 PM.

  6. #6
    Join Date
    Dec 2006
    Beans
    7,349

    Re: ....cool way to record your fave radio station for your mp3 player with wget ...

    Hi Shan!! Again it has been a while..

    You could also consider using FFmpeg, which certainly looks a bit cleaner than your vlc example although perhaps not as cool as the wget usage:

    Code:
    sleep 10m && \
    ffmpeg -i http://www.radioking.com/play/radio-planeta-occitania \
           -t 01:00:00.00 -c copy \
           "$(date "+%a %F [%T]").mp3"
    which of course sleeps for 10 minutes and then uses FFmpeg to record 60 minutes of your favoured stream...
    You think that's air you're breathing now?

  7. #7
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan Norwich
    Beans
    2,326
    Distro
    Lubuntu 22.04 Jammy Jellyfish

    Re: ....cool way to record your fave radio station for your mp3 player with wget ...

    Quote Originally Posted by andrew.46 View Post
    Hi Shan!! Again it has been a while..

    You could also consider using FFmpeg, which certainly looks a bit cleaner than your vlc example although perhaps not as cool as the wget usage:
    which of course sleeps for 10 minutes and then uses FFmpeg to record 60 minutes of your favoured stream...

    Hi Andrew yes nice route too
    Thanx





    PS: the game here for me is always gonna be the line that has the least digits in it resting those fingers
    PS2: really cool tho and we all love a ffmpeg solution to a question


    Code:
    sleep 30s && \> ffmpeg -i http://www.radioking.com/play/radio-planeta-occitania \
    >        -t 00:00:30.00 -c copy \
    >        "$(date "+%a %F [%T]")radio-planeta-occitania.mp3"
    ffmpeg version N-98601-g134a48a Copyright (c) 2000-2020 the FFmpeg developers
      built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
      configuration: --prefix=/home/shan/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/shan/ffmpeg_build/include --extra-ldflags=-L/home/shan/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/shan/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
      libavutil      56. 57.100 / 56. 57.100
      libavcodec     58. 98.100 / 58. 98.100
      libavformat    58. 49.100 / 58. 49.100
      libavdevice    58. 11.101 / 58. 11.101
      libavfilter     7. 87.100 /  7. 87.100
      libswscale      5.  8.100 /  5.  8.100
      libswresample   3.  8.100 /  3.  8.100
      libpostproc    55.  8.100 / 55.  8.100
    Input #0, mp3, from 'http://www.radioking.com/play/radio-planeta-occitania':
      Metadata:
        icy-br          : 128
        icy-description : La Radio de L'Occitania Granda 100 %  ÒC
        icy-genre       : Europe 
        icy-name        : RADIO PLANÈTA OCCITÀNIA
        icy-pub         : 1
        icy-url         : http://radio-planeta-occitania.blogspot.fr/
        StreamTitle     : 
      Duration: N/A, start: 0.000000, bitrate: 128 kb/s
        Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
    Output #0, mp3, to 'Thu 2021-07-29 [15:14:04]radio-planeta-occitania.mp3':
      Metadata:
        icy-br          : 128
        icy-description : La Radio de L'Occitania Granda 100 %  ÒC
        icy-genre       : Europe 
        icy-name        : RADIO PLANÈTA OCCITÀNIA
        icy-pub         : 1
        icy-url         : http://radio-planeta-occitania.blogspot.fr/
        StreamTitle     : 
        TSSE            : Lavf58.49.100
        Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
    Press [q] to stop, [?] for help
    size=     470kB time=00:00:29.98 bitrate= 128.3kbits/s speed=1.38x    
    video:0kB audio:469kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.153258%

    PS3: and you totally win on the tagging


    Code:
    WGET:
    
    mediainfo "♪♪-Thu 2021-07-29 [15-35-27]Radio-Planeta-Occitania.mp3"
    General
    Complete name                            : ♪♪-Thu 2021-07-29 [15-35-27]Radio-Planeta-Occitania.mp3
    Format                                   : MPEG Audio
    File size                                : 274 KiB
    Duration                                 : 17 s 554 ms
    Overall bit rate mode                    : Constant
    Overall bit rate                         : 128 kb/s
    
    
    Audio
    Format                                   : MPEG Audio
    Format version                           : Version 1
    Format profile                           : Layer 3
    Format settings                          : Joint stereo
    Duration                                 : 17 s 554 ms
    Bit rate mode                            : Constant
    Bit rate                                 : 128 kb/s
    Channel(s)                               : 2 channels
    Sampling rate                            : 44.1 kHz
    Frame rate                               : 38.281 FPS (1152 SPF)
    Compression mode                         : Lossy
    Stream size                              : 274 KiB (100%)
    
    
    
    
    =============
    FFMPEG:
    
    
    mediainfo Thu\ 2021-07-29\ \[15\:27\:38\]radio-planeta-occitania.mp3 
    General
    Complete name                            : Thu 2021-07-29 [15:27:38]radio-planeta-occitania.mp3
    Format                                   : MPEG Audio
    File size                                : 157 KiB
    Duration                                 : 10 s 4 ms
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 128 kb/s
    Writing library                          : Lavf58.49.100
    icy-br                                   : 128
    icy-description                          : La Radio de L'Occitania Granda 100 %  ÒC
    icy-genre                                : Europe 
    icy-name                                 : RADIO PLANÈTA OCCITÀNIA
    icy-pub                                  : 1
    icy-url                                  : http://radio-planeta-occitania.blogspot.fr/
    
    
    Audio
    Format                                   : MPEG Audio
    Format version                           : Version 1
    Format profile                           : Layer 3
    Format settings                          : Joint stereo / MS Stereo
    Duration                                 : 10 s 4 ms
    Bit rate mode                            : Variable
    Bit rate                                 : 128 kb/s
    Channel(s)                               : 2 channels
    Sampling rate                            : 44.1 kHz
    Frame rate                               : 38.281 FPS (1152 SPF)
    Compression mode                         : Lossy
    Stream size                              : 156 KiB (100%)
    Last edited by shantiq; July 29th, 2021 at 04:14 PM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu ... The Community ie 50 brains are better than one
    Playing with Slackware too now ...
    ShanArt

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •