sort recordings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 23 Apr 2006 19:31:35 +0300, you wrote:

>The /video directory is nfs-mounted to secondary
>box as /video/MainVDR.
>There those same recordings show in chronological
>order, how do I change that to same as main-box.

Recordings in subdirectories are normally not sorted by name.

Since I use VDR I do always two changes to the source of recording.c:

char *cRecording::StripEpisodeName(char *s)
{
#ifdef nodef
  char *t = s, *s1 = NULL, *s2 = NULL;
  while (*t) {
        if (*t == '/') {
           if (s1) {
              if (s2)
                 s1 = s2;
              s2 = t;
              }
           else
              s1 = t;
           }
        t++;
        }
  if (s1 && s2)
     memmove(s1 + 1, s2, t - s2 + 1);
#endif
  return s;
}

...

int cRecording::Compare(const cListObject &ListObject) const
{
#ifdef nodef
  cRecording *r = (cRecording *)&ListObject;
  return strcasecmp(SortName(), r->SortName());
#else
  cRecording *r = (cRecording *)&ListObject;
  char *s1 = SortName();
  char *s2 = r->SortName();

  if (s1[0] != '%' && s2[0] != '%')
       return(strcasecmp(s1, s2));


  if (s1[0] == '%' && s2[0] != '%')
       return 1;

  if (s1[0] != '%' && s2[0] == '%')
       return -1;

  return(strcasecmp(&s1[1], &s2[1]));
#endif
}


The first change cause the recordings in subdirectories to be sorted
(as far as I remember). The second change moves entries beginning with
% to the end of the list.

Emil


[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux