NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Add-ons (3rd party plugins, utilities and skins) v
« Previous 1 2 3 4 5 … 20 Next »
RRImport

 
  • 0 Vote(s) - 0 Average
RRImport
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,820
Threads: 954
Joined: May 2006
#1
2022-01-15, 07:00 PM (This post was last modified: 2022-02-15, 07:40 PM by mvallevand.)
Using NScripthelper and batch files to create custom filename can be difficult so I decided to create a utility based on a smart regex based renamer I have used for years https://github.com/nicjansma/rename-regex

This utility can be run from the command line and via post processing.bat  It can be run before or after other utilities like comskip since it also renames all matching files with different extensions

Before giving you the syntax NOTE that you should test this from the command line using the /p (pretend) option to confirm the naming is what you'd like.  Also make sure that all the variables are in double quotes.

The utility has more options but the syntax options I have used and tested are

RRImport filespec|recording_id  regex  newname [/p]

If it doesn't match the regex nothing is changed.

A "regex" is a geeky what of parsing a file into component pieces.  If you don't know what you are doing I wouldn't use it as there are two "built-in" options default and plex.  The prime purpose of this utility is for users who don't like the NextPVR generic names.

The new name can have regex variables, named variable I show below.  It isn't as complicated as it looks and is a lot easier then scripting.

Code:
?rn - Recording name
?t  - EPG title
?st - EPG subtitle
?se - S#E# if it exists.
?cn - Recorded channel name

?ys  - EPG year start
?Ms  -EPG month start
?ds  - EPG day start
?hs  - EPG hour start
?ms  - EPG minute start

?ye  - EPG year end
?Me  -EPG month end
?de - EPG day end
?he  - EPG hour end
?me  - EPG minute end

?rys  - Recording year start
?rMs  -Recording month start
?rds - Recording day start
?rhs  - Recording hour start
?rms  - Recording minute start

?rye  - Recording year end
?rMe  -Recording month end
?rde - Recording day end
?rhe  - Recording hour end
?rms  - Recording minute


For geeks the regex variable are $1, $2 etc.

I'll provide some common examples in the next post.  It might be better just to ask question on what you want.

Currently this is only for Windows.  To install unzip the attached in the NextPVR program folder and also this needed DLL

Code:
copy "C:\Program Files\NextPVR\runtimes\win-x64\native\e_sqlite3.dll" "C:\Program Files\NextPVR"

Martin


Attached Files
.zip   RRImport-1.0.0.zip (Size: 79.89 KB / Downloads: 7)
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,820
Threads: 954
Joined: May 2006
#2
2022-01-15, 07:40 PM (This post was last modified: 2022-01-15, 07:43 PM by mvallevand.)
Note for renaming generic file you need to know if you use plex or not. Please post any scenarios and I will add the sample. I don't support sub's dotted names, I don't really understand why they exist. So using these would lose your dots

Also please Add /p for testing this is important

In post processing I recommend %3 as the first variable but you can use %1

This is how some base NextPVR formats would be.

a. Default "?rn_?rys?rMs?rds_?rhs?rms?rhe?rme"

b. Plex "?rn_?rys-?rMs-?rds_?rhs?rms?rhe?rme"

c. S/E "?rn.?se.?st"

To get fancy for a couple or recent forum posts

Plex with month-day-year would be

- RRImport filename plex "?rn_?rMs-?rds-?yds_?rhs?rms?rhe?rme"

Plex with channel name

- RRImport filename plex "?rn_?cn_?rMs-?rds-?yds_?rhs?rms?rhe?rme"

Convert plex to default

- RRImport filename plex "?rn_?rys?rMs?rds_?rhs?rms?rhe?rme"

and convert default to plex

- RRImport filename default "?rn_?rys-?rMs-?rds_?rhs?rms?rhe?rme"

To rename a manual recording I would use a regex

- RRImport filename "(.+?)_(.+?)" "New Name_$2"

If you want to match any file the second parameter is ".+" you need the quotes I would not use that in post processing.

Remember again use /p for testing

Martin
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,820
Threads: 954
Joined: May 2006
#3
2022-02-20, 02:52 PM (This post was last modified: 2022-02-20, 03:30 PM by mvallevand.)
I just noticed I must have not clicked post when I uploaded a new version of this utility last week.

The syntax is the same as before the difference is the regex is applied to the full path and not the filename.  To use this the command line parameter is /d  Always make sure parameters are in quotes

Also in the regex you will need to use two back slashes \\  instead of one \

Like the original version you can use the filename, recording id or a file spec for the first parameter.  If you are using a filespec you can use the /r option to go through all the sub folders.

Two substitutions are available

?rn - recording name
?sf  - Season ##\  if available or empty otherwise

I am too lazy to go through the examples I typed last week, but if you have trouble figuring one out let me know

Code:
Copy to new drive and strip out the folder name

RRImport.exe  "D:\Recordings\*.ts" "(.+$)" "K:\NAS" /r /d /p

These parameters would copy all the sub folder names "(?:D:\\Recordings)(.+$)" "K:\NAS$1" /d /r /p

Be sure to use the /p when you test.

Note copying on the same drive is fast since it is a rename, but between drives it will be drive and network speed for potentially very large files.  If the source folder is empty  it will be remove unless it is the Recording directory.  Extra directories are not checked so you may need to create place holders.

Also note copying to a share my work from the command prompt but the service might not see it.

Martin


Attached Files
.zip   RRImport-1.0.1.zip (Size: 80.49 KB / Downloads: 0)
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode