Hi,

in Qobuz we have Work and Title, togheter they identify the track
title.

i.e.

inside the Album:

Haydn : Symphonies 78, 79, 80, 81

we have 4 different works:

Symphony No.78 in C Minor, Hob.I:78 - Edited H.C.Robbins Landon
Symphony No.79 in F Major, Hob.I:79 - Edited H.C. Robbins Landon
Symphony No.80 in D Minor, Hob.I:80 - Edited H.C. Robbins Landon
Symphony No.81 in G Major, Hob.I:81 - Edited H.C. Robbins Landon

Each work is composed by four movements, identified by a position and a
Cadenza, i.e. 1.Vivace or 3.Adagio...

I believe we all agree that what it should be displayed for a track is
something like that:

Symphony No.78 in C Minor, Hob.I:78 - Edited H.C.Robbins Landon: I.
Vivace

just because 1.Vicace could refer to either Symphony no, 78 or 81.


Problemi s that in Qobuz data the content of work and title is variable
depending on the vendor.

I solved the problem in a Java application with this code;


Code:
--------------------
    
  
  In  qobuz track class
  
  private String calcTitleOnly(String work, String title){
                
                /*
                Work: Cello Sonata in B-Flat Major, RV 46
                Title: Cello Sonata in B-Flat Major, RV 46: I. Preludio (Largo)
                Title only: I. Preludio (Largo)
                
                Work: Cello Sonata in B-Flat Major, RV 46
                Title: Cello Sonata in B-Flat Major, RV 46 : Cello Sonata in 
B-Flat Major, RV 46: I. Preludio (Largo)
                Title only: I. Preludio (Largo)
                */
                
                if  (title == null || "".equals(title)) return "";
                if (work == null || "".equals(work)) return title;
                
                String out="";
        
                for (String el :  title.split(":")){
                
                        if 
(!el.trim().toUpperCase().equals(work.trim().toUpperCase())){
                                
                                if (! out.isEmpty()) out= out.concat(" : ");
                                out= out.concat(el.trim());
                        }
                }
                if (out.isEmpty()) return title;
                return out;
        }
  
  in the consumer class (track is a qobuz track here).
  
  public String getTitle(){
  
  if (this.track == null) return "";
  if ( this.getWork().isEmpty()) return this.getTitleOnly();
               if ( this.getTitleOnly().isEmpty()) return this.track.getTitle();
                                
                return this.getWork().concat(" : ").concat(this.getTitleOnly());
  }
  
        public String getWork(){
  
  if (this.track == null) return "";
  if (this.track.getWork() == null) return "";
  
  return this.track.getWork();
  }
  
  public String getTitleOnly(){
  
  if (this.track == null) return "";
  if (this.track.getTitleOnly() == null) return "";
                
                return this.track.getTitleOnly();
  }
  
--------------------


Forgive spacing and feel free to translate it in Perl and use it in the
plugin.

Regards, Marco.



________________________________________________________________________
Author of C-3PO plugin,  Squeezelite-R2, Falcon Web interface - See
www.marcoc1712.it
------------------------------------------------------------------------
marcoc1712's Profile: http://forums.slimdevices.com/member.php?userid=34842
View this thread: http://forums.slimdevices.com/showthread.php?t=97146

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to