Re: Creating a month from the GiP filename
On Fri, 14 Oct 2022 01:07:35 +0100 Jeremy Nicoll - ml gip wrote: > On 2022-10-13 18:00, Chris Walker wrote: > > On Thu, 13 Oct 2022 16:38:54 +0100 > > Jeremy Nicoll - ml gip wrote: > > >> What IS the format you desire? > > > > I want the format to be //10 Oct where 10 > > Oct is derived from the > > Ah, I think I thought you meant "10 Oct" as in the 10th of Oct, but > now I think you mean " " and that's > presumably as you want folder names that sort nicely but are > instantly recognisable by month name as well. Yes, that is exactly what I want. Apologies for not explaining it more clearly. > If g_ip can't do what you want, I'd suggest you create the folders as, > say, > >//MNUM= > > which of course isn't what you want to end up with, but it'll at least > create the folder and put files in it. > > I'd then (under cron or something) run a script that looks for folders > with names containing that "/MNUM=" literal & rename them to what you > want them to be. > > Hmm, that won't work ... you can't rename the folder until every file > that would be generated in that folder has been written, and i suppose > that might take a whole month or more to happen. So it'd be better if > you just generated standalone files in a "just fetched" folder, then > the cron-driven script moves those into year/month folders. > > I think I'd just generate > >- > > in a general collection folder, and let a script rename/move them > afterwards. I run GiP on a Ubuntu server and for both radio and tv programmes they download into a folder of the name GiP_Downloads/radio or GiP_Downloads/tv (as appropriate [they're on separate raid drives]) and then some code runs to convert radio progs into MP3 and generate a .nfo file for use by LibreElec which runs on a Pi which resides in my lounge. For tv progs, it also generates a .hmi file for use by a Humax machine. But both types are then moved into GiP_Downloads/radio_downloads or tv_downloads. Films are moved from the GiP_Downloads/tv folder and saved on a third mount on the Ubuntu box but I do that with a preset and so your suggestion sounds like something I could do with another preset somehow. Not clear at this stage quite how I would do it but I think your idea about renaming sounds workable. I might even call it monthname to make it clear to me in the future what it does ;-) Thanks for the ideas. -- __ __| |_ __ __ .. / _/ _` \ V V / | mailto:cdw_pcm...@the-walker-household.co.uk | \__\__,_|\_/\_/ || ___ get_iplayer mailing list get_iplayer@lists.infradead.org http://lists.infradead.org/mailman/listinfo/get_iplayer
Re: Creating a month from the GiP filename
On 2022-10-13 18:00, Chris Walker wrote: On Thu, 13 Oct 2022 16:38:54 +0100 Jeremy Nicoll - ml gip wrote: What IS the format you desire? I want the format to be //10 Oct where 10 Oct is derived from the Ah, I think I thought you meant "10 Oct" as in the 10th of Oct, but now I think you mean " " and that's presumably as you want folder names that sort nicely but are instantly recognisable by month name as well. If g_ip can't do what you want, I'd suggest you create the folders as, say, //MNUM= which of course isn't what you want to end up with, but it'll at least create the folder and put files in it. I'd then (under cron or something) run a script that looks for folders with names containing that "/MNUM=" literal & rename them to what you want them to be. Hmm, that won't work ... you can't rename the folder until every file that would be generated in that folder has been written, and i suppose that might take a whole month or more to happen. So it'd be better if you just generated standalone files in a "just fetched" folder, then the cron-driven script moves those into year/month folders. I think I'd just generate - in a general collection folder, and let a script rename/move them afterwards. -- Jeremy Nicoll - my opinions are my own ___ get_iplayer mailing list get_iplayer@lists.infradead.org http://lists.infradead.org/mailman/listinfo/get_iplayer
Re: Creating a month from the GiP filename
On Thu, 13 Oct 2022 16:38:54 +0100 Jeremy Nicoll - ml gip wrote: > On 2022-10-13 11:40, Chris Walker wrote: > > > I sort them into the relevant year using > > / but I then have to run a bash script > > to create a folder for the relevant > > month with this code :- > > newdir=$month" "$(date -d $month/01 +%b) where the month has been > > extracted earlier such that I get a folder named '10 Oct'. > > > > But of course GiP already provides the firstbcastmonth so is there > > any way for GiP to create the month in the format I desire? > > What IS the format you desire? I want the format to be //10 Oct where 10 Oct is derived from the > What happens if instead of > >/ > > you use > >// Instead of the sub-directory being 10 Oct it would be simply be 10 and for purely personal reasons I don't want that. > (or possibly something like > > > // > > if the latter variable also exists? They all exist for the 2 programmes I identified and indeed I use a variation of those which already defined as . They form part of the filename to identify 'Sounds of the 60s with Tony Blackburn' which would simply overwrite the previous file if I didn't have the subfolder structure which I've chosen. > It's been a long time since I used get_iplayer, but I approached this > sort of problem by generating and issuing get_iplayer commands which > contained explicit filepaths invented to suit whatever I was fetching > rather than expecting get_iplayer to work out what to do with each > file. I don't think I'm expecting GiP to work out what to do with each file. I have preferences set in general but choose to do things slightly differently for a few programmes. -- __ __| |_ __ __ .. / _/ _` \ V V / | mailto:cdw_pcm...@the-walker-household.co.uk | \__\__,_|\_/\_/ || ___ get_iplayer mailing list get_iplayer@lists.infradead.org http://lists.infradead.org/mailman/listinfo/get_iplayer
Re: Creating a month from the GiP filename
On 2022-10-13 11:40, Chris Walker wrote: I sort them into the relevant year using / but I then have to run a bash script to create a folder for the relevant month with this code :- newdir=$month" "$(date -d $month/01 +%b) where the month has been extracted earlier such that I get a folder named '10 Oct'. But of course GiP already provides the firstbcastmonth so is there any way for GiP to create the month in the format I desire? What IS the format you desire? What happens if instead of / you use // (or possibly something like // if the latter variable also exists? It's been a long time since I used get_iplayer, but I approached this sort of problem by generating and issuing get_iplayer commands which contained explicit filepaths invented to suit whatever I was fetching rather than expecting get_iplayer to work out what to do with each file. -- Jeremy Nicoll - my opinions are my own ___ get_iplayer mailing list get_iplayer@lists.infradead.org http://lists.infradead.org/mailman/listinfo/get_iplayer