shell script to download recent recordings using getWizPnP -
shell script to download recent recordings using getWizPnP -
I'm trying to write unix shell script to download files to my unix box each night so I can view on other devices on my network. I only want to download recent files (I intend to delete anything on the unix box over say 2 weeks old) and don't want to waste time downloading stuff my seven year old has kept on the Beyonwiz for months.
I'm trying to use getWizPnP and pass it a file name or perl expression that will ensure I only transfer the recent files but I am having trouble figuring out what the native recording name format is, particularly the date stamp.
eg "getWizPnP.pl 2012" appears to get me a list of all the 2012 recordings.
"getWizPnP.pl apr" gets me stuff recorded in april, but as soon as I try "apr.15.2012" or "15.apr.2012" I get zip returned. Tried the usual date formats, used /, used spaces as separators - just cannot figure it.
I'm not too sure if the .'s aren't causing issues.
Anyone done this and got it working?
Anyone know what the date format is that getWizPnP operates on in the recording title?
I'm trying to use getWizPnP and pass it a file name or perl expression that will ensure I only transfer the recent files but I am having trouble figuring out what the native recording name format is, particularly the date stamp.
eg "getWizPnP.pl 2012" appears to get me a list of all the 2012 recordings.
"getWizPnP.pl apr" gets me stuff recorded in april, but as soon as I try "apr.15.2012" or "15.apr.2012" I get zip returned. Tried the usual date formats, used /, used spaces as separators - just cannot figure it.
I'm not too sure if the .'s aren't causing issues.
Anyone done this and got it working?
Anyone know what the date format is that getWizPnP operates on in the recording title?
-
- Wizard God
- Posts: 32706
- Joined: Tue Sep 04, 2007 13:49
- Location: Canberra; Black Mountain Tower transmitters
If you tell getWizPnP to download everything, it will only actually download things that aren't already in the destination folder.
It also has options to match on dates (but not on date ranges).
How to do both these things, (including the format of the dates to match against, and how to change that format) is in the Fine Manual
getWizPnP doesn't normally operate on the recording names with dates encoded in them, but you can see the encoding if you use --List. You can then fetch particular matches by using --BWName. But that's really doing things the hard way. The author of getWizPnP already decodes the date and time for you.
However, if you still want to do it yourself, the lines output by --List look like:
recordings/Minuscule Apr.13.2012_18.48
Which isn't all that hard to decode, but it is a bit tedious, especially if you want to calculate whether a recording lies in a date range.
It also has options to match on dates (but not on date ranges).
How to do both these things, (including the format of the dates to match against, and how to change that format) is in the Fine Manual
getWizPnP doesn't normally operate on the recording names with dates encoded in them, but you can see the encoding if you use --List. You can then fetch particular matches by using --BWName. But that's really doing things the hard way. The author of getWizPnP already decodes the date and time for you.
However, if you still want to do it yourself, the lines output by --List look like:
recordings/Minuscule Apr.13.2012_18.48
Which isn't all that hard to decode, but it is a bit tedious, especially if you want to calculate whether a recording lies in a date range.
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
The date format you need to match is something like "Wed Apr 18 07:48:00 2012". The following example (using a bash shell) will download recordings for the current month: A date range regex, i.e last two weeks, would be a lot harder to construct. I've never tried, as a regex is not the right tool for that. If you really want the last two weeks only, I'd use a programming language like python or perl and test dates extracted from the output of --List as prl suggests.
Code: Select all
getWizPnP --regexp "$(date +%b.*%Y)"
-
- Wizard God
- Posts: 32706
- Joined: Tue Sep 04, 2007 13:49
- Location: Canberra; Black Mountain Tower transmitters
I wasn't really recommending using --List and --BWName for this. If a complete rolling archive is wanted, then using a "copy everything" command is probably the simplest way to implement it. It will produce some warning messages like:Luke wrote:... A date range regex, i.e last two weeks, would be a lot harder to construct. I've never tried, as a regex is not the right tool for that. If you really want the last two weeks only, I'd use a programming language like python or perl and test dates extracted from the output of --List as prl suggests.
Code: Select all
Recording <name> already exists
Use --force to overwrite it
Note that while getWizPnP allows you to copy recursively over subfolders on the Beyonwiz, the folder structure is flattened into a single folder on the destination. To copy the folder hierarchy properly, something like
Code: Select all
#!/bin/sh
dest=~/beyonwiz
for f in Recordings{,/Movies{,/Drama,/Comedy}}; do
destfolder="$dest/$f"
if [ ! -d "$destfolder" ]; then
mkdir -p "destfolder"
fi
getWizPnP.pl --copy --resume --outDir="$destfolder" --folder="$f" ""
done
The above script should archive recordings in the following Beyonwiz folders:
Recordings
Recordings/Movies
Recordings/Movies/Drama
Recordings/Movies/Comedy
into corresponding folders on the host machine, under the beyonwiz folder in the user's home folder.
Running the script using crontab would fully automate the process.
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
Done.prl wrote:Yep. All this naked bash code should probably be moved into Software Developers so as to not offend the sensibilities of other readers
I have pushed you into the dark back corner of the forum so nobody can hear you unless they go there on purpose.
Cheers
Gully
_____________
Beyonwiz U4
Logitech Harmony Elite
Google Pixel 6 Pro
Gully
_____________
Beyonwiz U4
Logitech Harmony Elite
Google Pixel 6 Pro
That one works for me - thanks. What I am after is downloading say the last few days or the last month of recordings. I'll set this up in a CRON script to download (--noforce) all the recent recordings from the Beyonwiz to my Ubuntu server and also have some code that will delete anything over a month old. I didn't want to transfer everything as it takes a lot of time for the transfer and with the deleting of stuff over 30 days old on the Ubuntu box, I'd end up transferring a lot of files over and over again (as they may still be on the Beyonwiz but deleted off the Ubuntu server).Luke wrote:The date format you need to match is something like "Wed Apr 18 07:48:00 2012". The following example (using a bash shell) will download recordings for the current month:.Code: Select all
getWizPnP --regexp "$(date +%b.*%Y)"
This then allows me (or my wife) to catch up on the latest episodes of various shows on other devices such as a tablet computer elsewhere in the house (eg while doing the regular torture on the exercise bike