SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Github Development

Notices

SageTV Github Development Discussion related to SageTV Open Source Development. Use this forum for development topics about the Open Source versions of SageTV, hosted on Github.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-01-2015, 02:58 PM
AtariJeff's Avatar
AtariJeff AtariJeff is offline
Sage Aficionado
 
Join Date: Nov 2005
Location: Ontario, Canada
Posts: 276
Where does Sage build the recording file name?

I touched on this in another thread but I didn't want to hijack it further. As my first exercise with the source code I thought I would change the recording file name to not remove spaces and other characters (ex. the periods in Agents of S.H.I.E.L.D). I can find where a file name is passed in to be written but the code that "scrubs" the name eludes me
Reply With Quote
  #2  
Old 10-01-2015, 03:07 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
ADD Kicking in why oh why would you want periods in a title? Many scrapers see that as spaces and seems it would mess things up a bit.

As for parsing out I haven't looked for that in the code but shouldn't be hard guessing they are creating any time a channel is tuned or a recording starts.
Reply With Quote
  #3  
Old 10-01-2015, 11:15 PM
wnjj wnjj is offline
Sage Icon
 
Join Date: Jan 2009
Posts: 1,475
Looks like maybe line 4249 in MediaFile.java?

"public static String createValidFilename(String tryMe)"
Reply With Quote
  #4  
Old 10-02-2015, 04:38 AM
Monedeath Monedeath is offline
Sage Expert
 
Join Date: Sep 2009
Location: Idaho
Posts: 514
Quote:
Originally Posted by PLUCKYHD View Post
ADD Kicking in why oh why would you want periods in a title? Many scrapers see that as spaces and seems it would mess things up a bit.

As for parsing out I haven't looked for that in the code but shouldn't be hard guessing they are creating any time a channel is tuned or a recording starts.
I'm going to throw in a reminder that in Regular Expressions (RegEx) the dot also signifies any character (including no character in some implementations IIRC) so if you want to create file names that are hard to search for.....
Reply With Quote
  #5  
Old 10-02-2015, 05:07 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Having periods in the strings you are searching FOR has nothing to do with affecting the regex you are using to search for them, if the regex is built correctly. In any case, the region of MediaFile.java is where the names are generated. I can see a use for making a 'custom' naming scheme property entry to enable you to alter the default that sage uses - I also, on current systems, so no reason to exclude spaces and some special characters anymore either (except characters that can't exist in filenames, like drive and path separators).
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #6  
Old 10-02-2015, 05:12 AM
AtariJeff's Avatar
AtariJeff AtariJeff is offline
Sage Aficionado
 
Join Date: Nov 2005
Location: Ontario, Canada
Posts: 276
Thanks for the help. I'll take a look at that section.
Reply With Quote
  #7  
Old 10-02-2015, 06:26 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by AtariJeff View Post
Thanks for the help. I'll take a look at that section.
Keep in mind that sage metadata on season and episode number are not always correct in my finding. It's why I decided to name after BMT gets data.
Reply With Quote
  #8  
Old 10-02-2015, 09:26 AM
AtariJeff's Avatar
AtariJeff AtariJeff is offline
Sage Aficionado
 
Join Date: Nov 2005
Location: Ontario, Canada
Posts: 276
OK I have made my change to bypass the string editing if the property 'keep_original_filenames' is set to true in the Sage.properties file. A quick test did create a valid filename with spaces, etc. that played fine in Placeshifter in Windows 10 (woot, my first contribution to an open source project ). I am going to let it run over the weekend while I'm away and see how it goes.

For anyone interested, my repository is https://github.com/atarijeff/sagetv
Reply With Quote
  #9  
Old 10-02-2015, 09:31 AM
wnjj wnjj is offline
Sage Icon
 
Join Date: Jan 2009
Posts: 1,475
Quote:
Originally Posted by AtariJeff View Post
OK I have made my change to bypass the string editing if the property 'keep_original_filenames' is set to true in the Sage.properties file. A quick test did create a valid filename with spaces, etc. that played fine in Placeshifter in Windows 10 (woot, my first contribution to an open source project ). I am going to let it run over the weekend while I'm away and see how it goes.

For anyone interested, my repository is https://github.com/atarijeff/sagetv
You probably want to use "false" as the default for backward compatibility, unless I read it wrong.
Reply With Quote
  #10  
Old 10-02-2015, 09:36 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,712
Quote:
Originally Posted by AtariJeff View Post
OK I have made my change to bypass the string editing if the property 'keep_original_filenames' is set to true in the Sage.properties file. A quick test did create a valid filename with spaces, etc. that played fine in Placeshifter in Windows 10 (woot, my first contribution to an open source project ). I am going to let it run over the weekend while I'm away and see how it goes.

For anyone interested, my repository is https://github.com/atarijeff/sagetv
The only issue that I see here, is that you may end up with cases whereby you allow characters that are not valid. ie, on Windows "CSI: New Orleans" would not be valid, but, on linux it would. I'm sure there other cases as well. ie, if a title has "/" on linux or "\" on window, etc.

I think a better approach might be to build a whitelist of characters, in addition to the list that Sage is checking (ie, letters and numbers), and this whitelist would need to be different for linux and windows.
Reply With Quote
  #11  
Old 10-02-2015, 09:38 AM
AtariJeff's Avatar
AtariJeff AtariJeff is offline
Sage Aficionado
 
Join Date: Nov 2005
Location: Ontario, Canada
Posts: 276
Quote:
Originally Posted by wnjj View Post
You probably want to use "false" as the default for backward compatibility, unless I read it wrong.
Ah I think I see what your understanding was. To me, the original file names are the unedited, with spaces, etc. names. I guess it could be read as original being the edited, spaces removed version.

Perhaps a better name is in order.
Reply With Quote
  #12  
Old 10-02-2015, 09:48 AM
wnjj wnjj is offline
Sage Icon
 
Join Date: Jan 2009
Posts: 1,475
Quote:
Originally Posted by AtariJeff View Post
Ah I think I see what your understanding was. To me, the original file names are the unedited, with spaces, etc. names. I guess it could be read as original being the edited, spaces removed version.

Perhaps a better name is in order.
I think the name is ok. Didn't you add a new variable? That means the properties file would not have it defined and therefore should be false to not cause the early return if not defined.
Reply With Quote
  #13  
Old 10-02-2015, 09:48 AM
AtariJeff's Avatar
AtariJeff AtariJeff is offline
Sage Aficionado
 
Join Date: Nov 2005
Location: Ontario, Canada
Posts: 276
Quote:
Originally Posted by stuckless View Post
The only issue that I see here, is that you may end up with cases whereby you allow characters that are not valid. ie, on Windows "CSI: New Orleans" would not be valid, but, on linux it would. I'm sure there other cases as well. ie, if a title has "/" on linux or "\" on window, etc.

I think a better approach might be to build a whitelist of characters, in addition to the list that Sage is checking (ie, letters and numbers), and this whitelist would need to be different for linux and windows.
Agreed. It definitely needs to be more robust. My initial goal was to just get it to pass on the show name and description unchanged. I will have to experiment to see if Kodi will still recognize a show name with the "lightly scrubbed" titles. So "CSI New Orleans" vs "CSI: New Orleans". My suspicion is that it will.
Reply With Quote
  #14  
Old 10-02-2015, 09:56 AM
AtariJeff's Avatar
AtariJeff AtariJeff is offline
Sage Aficionado
 
Join Date: Nov 2005
Location: Ontario, Canada
Posts: 276
Quote:
Originally Posted by wnjj View Post
I think the name is ok. Didn't you add a new variable? That means the properties file would not have it defined and therefore should be false to not cause the early return if not defined.
Correct. The intention was to retain SageTV's original naming scheme unless the user wanted to turn on the feature specifically. Now that I think of it I should probably get the new variable added to the default properties file somewhere.
Reply With Quote
  #15  
Old 10-02-2015, 10:01 AM
wnjj wnjj is offline
Sage Icon
 
Join Date: Jan 2009
Posts: 1,475
Quote:
Originally Posted by AtariJeff View Post
Correct. The intention was to retain SageTV's original naming scheme unless the user wanted to turn on the feature specifically. Now that I think of it I should probably get the new variable added to the default properties file somewhere.

All you need to do is use ", false" in the getBoolean function. I'm pretty sure that's the return value if not defined.

Edit: looks like that's the value when the preferences aren't valid. Will check into what happens if undefined.
Edit2: yes, undefined uses the 2nd argument as the default.

Last edited by wnjj; 10-02-2015 at 10:07 AM.
Reply With Quote
  #16  
Old 10-02-2015, 10:42 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Quote:
Originally Posted by wnjj View Post
All you need to do is use ", false" in the getBoolean function. I'm pretty sure that's the return value if not defined.

Edit: looks like that's the value when the preferences aren't valid. Will check into what happens if undefined.
Edit2: yes, undefined uses the 2nd argument as the default.
Not only that, but I believe if a property is undefined, and you call getBoolean("property_name", false) then it will not only return false, but will also add "property_name=false" to the .properties file.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #17  
Old 10-02-2015, 10:57 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,712
Quote:
Originally Posted by Fuzzy View Post
Not only that, but I believe if a property is undefined, and you call getBoolean("property_name", false) then it will not only return false, but will also add "property_name=false" to the .properties file.
Which is not reflected in the Sage.properties until sage does a "save"... which is usually just before it shuts down.
Reply With Quote
  #18  
Old 10-02-2015, 11:10 AM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,319
Quote:
Originally Posted by stuckless View Post
Which is not reflected in the Sage.properties until sage does a "save"... which is usually just before it shuts down.
It saves that file every 5 minutes worst case if it has changes (part of the Seeker's loop); there's many other operations that cause it to be saved immediately.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #19  
Old 10-02-2015, 11:45 AM
AtariJeff's Avatar
AtariJeff AtariJeff is offline
Sage Aficionado
 
Join Date: Nov 2005
Location: Ontario, Canada
Posts: 276
I have updated my branch to exclude characters in the file name that Windows does not like. I'm on a Linux system but I'd like the logic to work universally. I won't know until a few days when SageTV tries to record a show called 'LOL :-)' and see a) if it works, and b) what Kodi does with it.
Reply With Quote
  #20  
Old 10-02-2015, 12:28 PM
wnjj wnjj is offline
Sage Icon
 
Join Date: Jan 2009
Posts: 1,475
Quote:
Originally Posted by AtariJeff View Post
I have updated my branch to exclude characters in the file name that Windows does not like. I'm on a Linux system but I'd like the logic to work universally. I won't know until a few days when SageTV tries to record a show called 'LOL :-)' and see a) if it works, and b) what Kodi does with it.
You still haven't fixed the default which you'll need if you want it in the core. Wait...or did you?

Last edited by wnjj; 10-02-2015 at 12:31 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New API build to fix .properties file issue PLUCKYHD Sage My Movies 2 01-22-2011 08:02 AM
Does SageTV create a zero length recording file before recording starts? michaeldjcox SageTV Linux 6 10-18-2010 06:03 AM
mpg video file Sage thinks is an audio file kmp14 SageTV Software 1 03-14-2010 08:01 PM


All times are GMT -6. The time now is 10:15 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.