FU Logo
  • Startseite
  • Kontakt
  • Impressum
  • Home
  • Listenauswahl
  • Anleitungen

Re: [linux-minidisc] trying to copy 1st mp3 to mz-rh1

<-- thread -->
<-- date -->
  • From: Rene Rebe <rene@exactcode.de>
  • To: glaubitz@physik.fu-berlin.de
  • Date: Tue, 28 Mar 2017 00:09:43 +0200 (CEST)
  • Cc: linux-minidisc@lists.fu-berlin.de
  • Subject: Re: [linux-minidisc] trying to copy 1st mp3 to mz-rh1

From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Subject: Re: [linux-minidisc] trying to copy 1st mp3 to mz-rh1
Date: Mon, 27 Mar 2017 23:32:38 +0200

> On 03/27/2017 11:07 PM, René Rebe wrote:
> > I can confirm that after copying the new TRKIDX01.HMA to TRKIDX03.HMA my himdcli as well as the MZ-RH1 seed the newly added mp3 track and even plays it. Yay.
> 
> From our wiki [1]:
> 
> > The numeric appendices are increased from time to time. Obviously, simply adding one mp3-track with the
> > transfer-software for Mac does not increase the numbers. It might be only increased when adding
> > ATRAC-tracks or when adding more than one file. The files with the highest index are the only to
> > contain valid data. When several trkidx0X.hma can be found for example, only the file with the
> > highest index contains non-zero content (the other are zero-filled, but not zero-size).

Yeah, well, I also reversed some initial on disc format that you
quoted in your wiki (svn.exactcode.de/minidisc, ...), and I also ready
thru the wiki today quite a few times.

As far as I can see the libhimd index code propbably only worked by
accident in the past, based on OS sorting last modified file first or
so.

This modification makes the TIF editing and thus mp3 upload work for
me, by scanning for the highest number, not stopping at the first
match.  Maybe for plenty of edits is shoudl scan without the 0 prefix
and take double digit numbers into account, too?

diff --git a/libhimd/himd.c b/libhimd/himd.c
index 9695ed5..c0c6e51 100644
--- a/libhimd/himd.c
+++ b/libhimd/himd.c
@@ -87,39 +87,38 @@ static int scanforatdata(GDir * dir)
 static int scanfortif(GDir * dir, int* oldnum, int *newnum)
 {
     const char * hmafile;
-    int found_unused=FALSE, found_used=FALSE;
+    int found_unused=-1, found_used=-1;
     int old_datanum, new_datanum;
 
     while((hmafile = g_dir_read_name(dir)) != NULL)
     {
 	// Look for old version
-	if(!found_unused)
-	    {
-		if(g_ascii_strncasecmp(hmafile,"_rkidx0",7) == 0 &&
-		   strlen(hmafile) == 12 &&
-		   isxdigit(hmafile[7]) &&
-		   g_ascii_strncasecmp(hmafile+8,".hma",4) == 0)
-		    {
-			sscanf(hmafile+7,"%x",&old_datanum);
+	if(g_ascii_strncasecmp(hmafile,"_rkidx0",7) == 0 &&
+	   strlen(hmafile) == 12 &&
+	   isxdigit(hmafile[7]) &&
+	   g_ascii_strncasecmp(hmafile+8,".hma",4) == 0)
+	{
+		sscanf(hmafile+7,"%x",&old_datanum);
+		if (old_datanum > found_unused) {
 			*oldnum = old_datanum;
-			found_unused = TRUE;
-		    }
-	    }
+			found_unused = old_datanum;
+		}
+	}
 	// Look for current version
-	if(!found_used)
-	    {
-		if(g_ascii_strncasecmp(hmafile,"trkidx0",7) == 0 &&
-		   strlen(hmafile) == 12 &&
-		   isxdigit(hmafile[7]) &&
-		   g_ascii_strncasecmp(hmafile+8,".hma",4) == 0)
-		    {
-			sscanf(hmafile+7,"%x",&new_datanum);
+	if(g_ascii_strncasecmp(hmafile,"trkidx0",7) == 0 &&
+	   strlen(hmafile) == 12 &&
+	   isxdigit(hmafile[7]) &&
+	   g_ascii_strncasecmp(hmafile+8,".hma",4) == 0)
+	{
+		sscanf(hmafile+7,"%x",&new_datanum);
+		if (new_datanum > found_unused) {
 			*newnum = new_datanum;
-			found_used = TRUE;
-		    }
-	    }
+			found_used = new_datanum;
+		}
+	}
     }
-    return (FALSE || found_unused || found_used);
+
+    return (FALSE || found_unused >= 0 || found_used >= 0);
 }
 
 static void nong_inplace_ascii_down(gchar * string)


> > Btw. a big thanks for all the efforts over my initial look in 2006. So great to see all this bits public.
> 
> Actually, the initial efforts were the libnetmd project [2]. I started linux-minidisc
> with Michael Karcher around 2009 from scratch to enable HiMD support for Linux and we
> gained most of the information of the inner workings of HiMD and NetMD by reverse-
> engineering "HiMD Music Transfer for Mac" and "Sony SonicStage". There was no existing
> usable documentation on how HiMD and the interesting parts of NetMD worked when we
> started the project. That's why we were the first project to support actual transfers
> to and from HiMD and to NetMD.
> 
> At some point, we decided we should merge our codebase with the libnetmd project and
> extend libnetmd with the NetMD functionality we had in the Python NetMD code. So
> we ported the NetMD Python code to C code with the help of a GSoC student during
> Google's Summer of Code in 2011.

I just tried to dump an Atrac+ track from an old, classic MD using the
upload.py.  Doing so I get some '01 - .aea' file. Although I read the
wiki like three times now, what step is needed to get a file that
latest ffmpeg would play?

Thanks,
	René

> Adrian
> 
> > [1] https://wiki.physik.fu-berlin.de/linux-minidisc/doku.php?id=himddiskformat#files
> > [2] http://libnetmd.sourceforge.net/
> 
> -- 
>  .''`.  John Paul Adrian Glaubitz
> : :' :  Debian Developer - glaubitz@debian.org
> `. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
>   `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

-- 
  René Rebe, ExactCODE GmbH, Lietzenburger Str. 42, DE-10789 Berlin
  http://exactcode.com | http://t2-project.org | http://rene.rebe.de



<-- thread -->
<-- date -->
  • Follow-Ups:
    • Re: [linux-minidisc] trying to copy 1st mp3 to mz-rh1
      • From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
  • References:
    • [linux-minidisc] trying to copy 1st mp3 to mz-rh1
      • From: René Rebe <rene@exactcode.com>
    • Re: [linux-minidisc] trying to copy 1st mp3 to mz-rh1
      • From: René Rebe <rene@exactcode.com>
    • Re: [linux-minidisc] trying to copy 1st mp3 to mz-rh1
      • From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
  • linux-minidisc - March 2017 - Archives indexes sorted by:
    [ thread ] [ subject ] [ author ] [ date ]
  • Complete archive of the linux-minidisc mailing list
  • More info on this list...

Hilfe

  • FAQ
  • Dienstbeschreibung
  • ZEDAT Beratung
  • postmaster@lists.fu-berlin.de

Service-Navigation

  • Startseite
  • Listenauswahl

Einrichtung Mailingliste

  • ZEDAT-Portal
  • Mailinglisten Portal