Bug 7963 - Bitrate limiting does not work with non-latin files
: Bitrate limiting does not work with non-latin files
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Streaming From SlimServer
: 7.0.1
: PC Windows XP
: P1 normal (vote)
: 7.x
Assigned To: Spies Steven
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-24 06:20 UTC by Yuly Milner
Modified: 2009-07-31 10:20 UTC (History)
4 users (show)

See Also:
Category: ---


Attachments
Server log file (9.68 KB, text/plain)
2008-04-24 06:20 UTC, Yuly Milner
Details
only manipulate local file names/paths (853 bytes, patch)
2008-05-04 11:36 UTC, Michael Herger
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuly Milner 2008-04-24 06:20:49 UTC
Created attachment 3284 [details]
Server log file

When trying to play a flac track with non-latin characters in its name (cyrillic), the streaming fails if the player is configured for bitrate limiting.
If the same flac file is renamed to some latin-only name, the streaming works.
If the original file is played on a player with no bitrate limiting configured, it also works.
Server log file is attached (with player.source debug enabled).
The version is:
SqueezeCenter Version: 7.0.1 - 18806 @ Wed Apr 16 00:21:43 PDT 2008 - Windows Server 2003 - EN - cp1251
Server IP address: 192.168.11.6
Perl Version: 5.8.8 MSWin32-x86-multi-thread
MySQL Version: 5.0.22-community-nt
Comment 1 Spies Steven 2008-04-24 10:46:24 UTC
Reproduced on Mac OS X as well.

Would this one be for you Michael?
Comment 2 Michael Herger 2008-04-24 11:04:48 UTC
very likely related to bug 7815 - transcoders don't work with non-latin stuff. Never got an answer on the other bug. 
Comment 3 Michael Herger 2008-04-25 07:26:25 UTC
Yuly/Steven - could you please give the following patch a try?

Index: /Users/mh/Documents/workspace/trunk/server/Slim/Player/TranscodingHelper.pm
===================================================================
--- /Users/mh/Documents/workspace/trunk/server/Slim/Player/TranscodingHelper.pm	(revision 19159)
+++ /Users/mh/Documents/workspace/trunk/server/Slim/Player/TranscodingHelper.pm	(working copy)
@@ -19,6 +19,7 @@
 use Slim::Utils::Misc;
 use Slim::Utils::OSDetect;
 use Slim::Utils::Prefs;
+use Slim::Utils::Unicode;
 
 our %commandTable = ();
 our %binaries = ();
@@ -342,7 +343,10 @@
 	if ( $command =~ /mov123/ && $fullpath =~ /^http/ ) {
 		$filepath = $fullpath;
 	}
-	
+
+	$filepath = Slim::Utils::Unicode::utf8decode_locale($filepath);
+	$fullpath = Slim::Utils::Unicode::utf8decode_locale($fullpath);
+
 	$command =~ s/\$FILE\$/"$filepath"/g;
 	$command =~ s/\$URL\$/"$fullpath"/g;
 	$command =~ s/\$RATE\$/$sampleRate/g;
Comment 4 Yuly Milner 2008-04-25 14:25:13 UTC
Did not work for me:(
Comment 5 Michael Herger 2008-04-25 14:29:29 UTC
what's your locale?
Comment 6 Yuly Milner 2008-04-25 14:35:56 UTC
CP-1251
Comment 7 Chris Owens 2008-04-28 09:13:04 UTC
Steven would you see if the patch works for you?
Comment 8 Michael Herger 2008-04-28 09:18:52 UTC
The patch is working for me on OSX, but not on Windows. I don't know what's wrong here, have tested any conversion possible, but somehow it just doesn't work :-(.
Comment 9 Spies Steven 2008-04-28 10:13:02 UTC
Michael, could it not working on Windows be related to the 8.3 name equivalents function enabled for bug 2475? 
Comment 10 Michael Herger 2008-04-28 10:22:26 UTC
Just spent a few hours on this bug, but 8.3 didn't come to my mind... thanks for the hint - will give it a try!
Comment 11 Michael Herger 2008-04-29 03:09:18 UTC
Yuly - as you're on Windows, could you please give the following patch a try?

Index: D:/eclipse/trunk/server/Slim/Player/TranscodingHelper.pm
===================================================================
--- D:/eclipse/trunk/server/Slim/Player/TranscodingHelper.pm	(revision 19226)
+++ D:/eclipse/trunk/server/Slim/Player/TranscodingHelper.pm	(working copy)
@@ -342,7 +342,12 @@
 	if ( $command =~ /mov123/ && $fullpath =~ /^http/ ) {
 		$filepath = $fullpath;
 	}
-	
+
+	if (Slim::Utils::OSDetect::OS() eq 'win') {
+		require Win32;
+		$filepath = Win32::GetShortPathName($filepath);
+	}
+
 	$command =~ s/\$FILE\$/"$filepath"/g;
 	$command =~ s/\$URL\$/"$fullpath"/g;
 	$command =~ s/\$RATE\$/$sampleRate/g;

This is basically using 8.3 filenames instead of the full names which is working around non-latin character issues. Seems to be working for me.
Comment 12 Yuly Milner 2008-04-29 04:56:54 UTC
Works for me too! Thanks!
Comment 13 Michael Herger 2008-04-29 05:29:17 UTC
Wow, thanks for the quick feedback - only had time to get lunch :-).

Change 19234 - utf8decode non-latin file names on non-Windows systems, or use the DOS 8.3 name on Windows instead
Comment 14 Spies Steven 2008-05-02 11:49:55 UTC
Verified fixed in 7.0.1 - 19251
Comment 15 Adrian Smith 2008-05-03 04:42:31 UTC
Michael - this fix breaks transcoding of remote streams which use $FILE$ in their transcoding command (I expect mov123, wmadec and know alien)

I suggest we only do the file munging if $filepath is a local file.  Can you test your problem cases for this.

See forums http://forums.slimdevices.com/showthread.php?t=47039&page=4
Comment 16 Michael Herger 2008-05-04 11:36:41 UTC
Created attachment 3322 [details]
only manipulate local file names/paths

Triode - can't test this, as AlienBBC doesn't work on this box (for whatever reason). Would it work for you?
Comment 17 Adrian Smith 2008-05-04 12:21:19 UTC
I don't have a windows system to test on either at present, but I believe it will fix the problem.  Assuming it fixes your original problem then I suggest committing it.
Comment 18 Michael Herger 2008-05-05 01:13:46 UTC
change 19421 - do not munge remote stream URLs, but only change when playing local media files
Comment 19 Spies Steven 2008-05-06 15:07:01 UTC
Verified Fixed with SqueezeCenter Version: 7.0.1 - 19422 
Comment 20 Spies Steven 2008-05-13 15:42:21 UTC
Bitrate limiting is broken again with accented characters after change 19663 for bug 8118 on Mac OS X.  Will test with Win XP.
Comment 21 Spies Steven 2008-05-14 09:06:18 UTC
With a fresh install of SqueezeCenter 7.0.1 I am no longer able to reproduce on Mac OS X.  Even going back and doing a fresh install of a version before change 19234 I am no longer able to reproduce.  I'm stumped. 
Comment 22 Spies Steven 2008-05-14 12:19:26 UTC
Closing again since I can no longer reproduce but will keep an eye on it.
Comment 23 James Richardson 2008-05-15 12:31:03 UTC
This bug has recently been fixed in the latest release of SqueezeCenter 7.0.1

Please try that version, if you still see the error, then reopen this bug.

To download this version, please navigate to: http://www.slimdevices.com/su_downloads.html
Comment 24 Chris Owens 2009-07-31 10:20:05 UTC
Reduce number of active targets for SC