SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Github Development
Forum Rules FAQs Community Downloads Today's Posts Search

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
  #21  
Old 11-03-2016, 06:44 AM
sigl sigl is offline
Sage User
 
Join Date: Apr 2011
Location: Montréal, Canada
Posts: 34
Hello, I retry using "allow_unicode_characters_in_generated_filenames" and the debug to ON.

The original program name is : "Le plus grand musée du monde"
The saved file created by SageTv is : "Le plus grand musée du monde - Le Petit Palais - 214054-0.mpg"




Finally the recording does not stay at 0 KB (i'm sorry), it grows correctly and the file can be read with VCL media player.

But the problem stay. After the recording end it create and error and the recording is not available in Sage Recordings but it exists in the recording directory.

Quote:
Error Message Details

The device input "HDHomeRun 103958fe Tuner 1 Digital TV Tuner" failed to record "Le plus grand mus?e du monde" on CFTUDT on physical channel 29-29-1 at Thu 11/3 8:00. The TV source for this input may have become disconnected, powered off, has lost its signal, the channel is no longer available, or the device is failing.

I have include the sagetv_0.txt to help debugging


----
Update .....


My SageTV server is running on a Linux machine but the recording are saved on a mounted windows share (using /etc/fstab mount). I was wondering if the problem could be cause by this. So I remove the mount to make sure the recordings stay on Linux.. Now when the recording start it create two files !

The original program was "Ça finit bien la semaine"
The first filename create is : "?a finit bien la semaine - S07E06 - 213859-0.mpg" and it's 0 KB
the second filename create is : "Ça finit bien la semaine - S07E06 - 213859-0.mpg" and it size is correct.

But I got the same error as before.
Attached Files
File Type: zip sagetv_0.zip (296.3 KB, 133 views)

Last edited by sigl; 11-03-2016 at 09:07 AM. Reason: Deeper investigation
Reply With Quote
  #22  
Old 11-03-2016, 11:30 AM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
This is some kind of Java/platform issue...here's a very relevant part of the logs:

Thu 11/3 8:20:22.743 [AsyncWatch@29f7bdb3] Seeker.startRecord(HDHomeRun 103958fe Tuner 1 A[214054,212051,"Le plus grand mus?e du monde",74875@1103.08:00,30,T], currTime=Thu 11/3 8:20:22.742) currRecord=null switch=false
Thu 11/3 8:20:22.743 [AsyncWatch@29f7bdb3] Setting up MMC video for recording new show & tuning channel conn=HDHomeRun 103958fe Tuner 1 Digital TV Tuner
Thu 11/3 8:20:22.743 [AsyncWatch@29f7bdb3] Using quality setting "Great" for recording
Thu 11/3 8:20:22.743 [AsyncWatch@29f7bdb3] VideoStorage for new file: /var/media/tv - Leave Free 25.0 GB
Thu 11/3 8:20:22.745 [AsyncWatch@29f7bdb3] MediaFile unable to create file for next segment:java.io.IOException: No such file or directory
Thu 11/3 8:20:22.745 [AsyncWatch@29f7bdb3] Added:MediaFile[id=236812 A[214054,212051,"Le plus grand mus?e du monde",74875@1103.08:00,30,T] mask=TV host=SageTVSrv encodedBy=HDHomeRun 103958fe Tuner 1 CFTUDT format=MPEG2-PS 0:00:00 0 kbps [] /var/media/tv/Le plus grand mus?e du monde - Le Petit Palais - 214054-0.mpg, Seg0[Thu 11/3 8:20:22.743-Wed 12/31 19:00:00.000]]

Notice where it failed trying to create the file...it's because something went bad when SageTV was telling Java simply to create the file with the unicode filename.

But then when it asks the HDHomeRun code to record it, that works fine because the native code doesn't have an issue with the unicode filenames apparently...but Java isn't able to properly reconcile them.

I did some quick research on this...and it's very complicated, so I'm not sure exactly what to do in order to resolve this.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #23  
Old 11-03-2016, 12:14 PM
sigl sigl is offline
Sage User
 
Join Date: Apr 2011
Location: Montréal, Canada
Posts: 34
Ok if we forgot to use the Unicode way I think the problem could be solve for accents characters by removing them like mentioned in the following link:

http://stackoverflow.com/questions/3...-regular-lette


I think it would be easy to do that in the function createValidFilename in the MediaFile.java file something like this:

Code:
public static String createValidFilename(String tryMe)
  {
    if (tryMe == null) return "null";
    int len = tryMe.length();
    StringBuffer sb = new StringBuffer(len);
	
=====> tryMe= Normalizer.normalize(tryMe, Normalizer.Form.NFD);
=====> tryMe = tryMe.replaceAll("[^\\p{ASCII}]", "");
	
    for (int i = 0; i < len; i++)
    {
      char c = tryMe.charAt(i);
      // Stick with ASCII to prevent issues with the filesystem names unless a custom property is set
      if (Sage.getBoolean("allow_unicode_characters_in_generated_filenames", false))
      {
        if (Character.isLetterOrDigit(c)
          || (Sage.getBoolean("extended_filenames", false) && LEGAL_FILE_NAME_CHARACTERS.contains(String.valueOf(c))))
            sb.append(c);
      } else if ((c >= 'a' && c <= 'z') ||
        (c >= '0' && c <= '9') ||
        (c >= 'A' && c <= 'Z') ||
        // Jeff Harrison - 09/10/2016
     	  // Keep spaces and other extra characters in filenames
        (Sage.getBoolean("extended_filenames", false) && LEGAL_FILE_NAME_CHARACTERS.contains(String.valueOf(c))))
          sb.append(c);
    }
    return sb.toString();
  }
This way the accents would be removed but not then entire caracter it would create more realist filename.

Last edited by sigl; 11-03-2016 at 12:16 PM. Reason: coding error
Reply With Quote
  #24  
Old 11-04-2016, 12:20 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
Do you want to do the change yourself? I'd recommend just doing the normalize if allowing unicode characters is not enabled (so you don't strip them for those who can handle them on their platform) and then using the rest of the code as is. I wouldn't do the replaceAll for non-ascii characters since that's already handled in the code below.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #25  
Old 11-04-2016, 01:32 PM
sigl sigl is offline
Sage User
 
Join Date: Apr 2011
Location: Montréal, Canada
Posts: 34
I would prefer if you do it. Here is the correct tested code. Don't forget to add the import java.text.Normalizer in the beginning of the file




Code:
public static String createValidFilename(String tryMe)
  {
    if (tryMe == null) return "null";
	
    tryMe= Normalizer.normalize(tryMe, Normalizer.Form.NFD);

    int len = tryMe.length();
    StringBuffer sb = new StringBuffer(len);

	
    for (int i = 0; i < len; i++)
    {
      char c = tryMe.charAt(i);
      // Stick with ASCII to prevent issues with the filesystem names unless a custom property is set
      if (Sage.getBoolean("allow_unicode_characters_in_generated_filenames", false))
      {
        if (Character.isLetterOrDigit(c)
          || (Sage.getBoolean("extended_filenames", false) && LEGAL_FILE_NAME_CHARACTERS.contains(String.valueOf(c))))
            sb.append(c);
      } else if ((c >= 'a' && c <= 'z') ||
        (c >= '0' && c <= '9') ||
        (c >= 'A' && c <= 'Z') ||
        // Jeff Harrison - 09/10/2016
     	  // Keep spaces and other extra characters in filenames
        (Sage.getBoolean("extended_filenames", false) && LEGAL_FILE_NAME_CHARACTERS.contains(String.valueOf(c))))
          sb.append(c);
    }
    return sb.toString();
  }

Last edited by sigl; 11-07-2016 at 12:06 PM. Reason: Coding error
Reply With Quote
  #26  
Old 11-07-2016, 01:13 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
OK, done.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #27  
Old 11-07-2016, 01:38 PM
sigl sigl is offline
Sage User
 
Join Date: Apr 2011
Location: Montréal, Canada
Posts: 34
Hello,


I think like the way you made the modifications there will be a problem with the for loop after. The tryMe result after the normalize function will not be the same size. It will grow as added characters will appears. I my mind we have to recalculate the size of the lenvariable after the normalize function.
Reply With Quote
  #28  
Old 11-08-2016, 12:40 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
Quote:
Originally Posted by sigl View Post
Hello,


I think like the way you made the modifications there will be a problem with the for loop after. The tryMe result after the normalize function will not be the same size. It will grow as added characters will appears. I my mind we have to recalculate the size of the lenvariable after the normalize function.
Oh whoops...good point. I also updated the test cases so that it would catch this problem as well. Change committed.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
Reply


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

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
Unwanted channels on Linux with HDHomeRun mwnswiss SageTV Github Development 0 10-10-2015 04:11 PM
Will an HDHomeRun tune better than an HVR-1600? gregmac Hardware Support 2 11-25-2010 09:11 AM
Can tune some channels in HDHomeRun QuickTV but not SageTV Rosenbagel Hardware Support 5 08-06-2010 11:32 AM
HDHomerun Slow to Tune Electronicbuff Hardware Support 4 08-12-2009 08:10 AM
PVR-150 no sound on a few channels (+ How to fine tune channels?) Evil Techie Hardware Support 12 12-08-2005 04:12 PM


All times are GMT -6. The time now is 01:59 AM.


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