Bug 5848 - Slim/Utils/Strings.pm too picky about plugins strings.txt line endings
: Slim/Utils/Strings.pm too picky about plugins strings.txt line endings
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Plugins
: 7.0
: PC Other
: P2 enhancement (vote)
: ---
Assigned To: Unassigned bug - please assign me!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-18 19:08 UTC by Peter Watkins
Modified: 2008-12-18 11:12 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Watkins 2007-10-18 19:08:26 UTC
Converting some old code, SC7 complained about strings.txt for two plugins. The problem seemed to be that the plugins were originally written on Windows, so when I copied Plugin.pm and pared it down to make strings.txt, my strings.txt files had DOS line endings. Slim/Utils/Strings.pm uses chomp() to remove line endings (I'm not a fan of chomp) which leaves DOS \r at the end of strings when SC7 runs on Unix. I'd suggest something like the following (untested; I just used dos2unix to fix my files) -- with strings moving out of .pm files and developers on multiple platforms, SC7 shouldn't be so picky.

--- Slim/Utils/Strings.pm       (revision 13905)
+++ Slim/Utils/Strings.pm       (working copy)
@@ -270,7 +270,7 @@
        LINE: for my $line (split('\n', $$text)) {

                $ln++;
-               chomp($line);
+               $line =~ s/[\r\n]//g;

                next if $line =~ /^#/;
                next if $line !~ /\S/;
Comment 1 KDF 2007-12-11 08:34:40 UTC
Michael, what is the feeling regarding relaxing the line ending requirement for strings files?
Comment 2 Michael Herger 2007-12-11 08:44:38 UTC
The other day I asked myself why not? Seems pretty obvious to me. Feel free to go ahead. Thanks!
Comment 3 KDF 2007-12-11 09:29:41 UTC
done in change 15177.  The spec for SS/SC code has always been unix line endings, and this remains so even for strings.txt files.  However, this will allow those endings to be dos style and not cause total breakage of the parsing. reopen if there are any issues.
Comment 4 Chris Owens 2008-03-07 09:05:14 UTC
This bug is being closed since it was resolved for a version which is now released!  Please download the new version of SqueezeCenter (formerly SlimServer) at http://www.slimdevices.com/su_downloads.html

If you are still seeing this bug, please re-open it and we will consider it for a future release.