I tried again, but not knowing anything about perl certainly doesn't
help I hacked a Slim/Formats/Mod.pm file based on other ones but it
doesn't seem to use it at all when scanning the files.

I'll do a recap here of what I did in case someone can spot an obvious
mistake.

I added a binary of mikmod in Bin/i368-linux with correct permissions

Added this line in types.conf:

Code:
--------------------
    
  mod   it,mod,s3m,xm   audio/x-mod   audio
  
--------------------

Added these two lines in convert.conf


Code:
--------------------
    
  mod flc * *
  [mikmod] -q --norc -X -i -d 5 $FILE$ | [flac] -cs --compression-level-0 
--totally-silent --endian little --channel 2 --bps 16 --sample-rate 44100 
--sign signed -
  
--------------------


Added these lines in strings.txt (for the interface):


Code:
--------------------
    
  MOD
  EN      Modules
  ES      Modules
  FR      Modules
  
--------------------


And created a file called Slim/Formats/Mod.pm (and that was the tricky
part cause I don't know perl):


Code:
--------------------
    
  package Slim::Formats::Mod;
  
  # SlimServer Copyright (c) 2001-2004 Sean Adams, Slim Devices Inc.
  # This program is free software; you can redistribute it and/or
  # modify it under the terms of the GNU General Public License,
  # version 2.
  
  use strict;
  
  # Given a file, return a hash of name value pairs,
  # where each name is a tag name.
  sub getTag {
  
  my $file = shift || "";
  
  my $filesize = -s $file;
  
  $::d_formats && msg( "Opening Module information for $file\n");
  
  # Make sure the file exists.
  return undef unless $filesize && -r $file;
  
  $::d_formats && msg( "Reading Module information for $file\n");
  
  my $tags = {};
  
  my $f;
  
  open $f, "<$file" || return undef;
  $::d_formats && msg("opened file $file\n");
  
  # Settings that mikmod uses to convert the module (matches what's in 
convert.conf)
  $endian           = 0; # Modules converted by mikmod are little-endian
  $numChannels      = 2; # Stereo.
  $sampleSize       = 16;
  $samplesPerSecond = 44100;
  $numSampleFrames  = 999999; # Will need to use the libmikmod interface to get 
that later
  
  $tags->{'ENDIAN'}     = $endian;
  $tags->{'FS'}         = $filesize;
  $tags->{'CHANNELS'}   = $numChannels;
  $tags->{'SAMPLESIZE'} = $sampleSize;
  $tags->{'SIZE'}       = $numSampleFrames * $numChannels * $sampleSize / 8;
  $tags->{'OFFSET'}     = 0;
  $tags->{'RATE'}       = $samplesPerSecond;
  $tags->{'BITRATE'}    = $samplesPerSecond * $numChannels * $sampleSize;
  $tags->{'SECS'}       = $numSampleFrames / $samplesPerSecond;
  $tags->{'BLOCKALIGN'} = $numChannels * $sampleSize / 8;
  
  return $tags;
  }
  
  1;
  
--------------------


The modules that I put in my music folder show just fine but if I
enable d_format, clear the cache an rescan the debug messages I put in
this file don't show up. So I think I need to do something else to get
slimserver to use it? And if I play them with d_source enable it tells
me that everythig is set to zero so it doesn't bother playing it.

BTW where could I find a list of tags that I can set for the hash?
Later on I'd like to fill in artist and title from a text file (since
it's not stored in any standard format in the modules themselves).

Thanks for your help.

-WildCoder


-- 
WildCoder
------------------------------------------------------------------------
WildCoder's Profile: http://forums.slimdevices.com/member.php?userid=1827
View this thread: http://forums.slimdevices.com/showthread.php?t=17845

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/unix

Reply via email to