format path from artist and filename

pull/4/head
nico202 2018-05-24 18:17:37 +02:00
parent 7c24564cfa
commit a6d270b7a4
2 changed files with 34 additions and 3 deletions

View File

@ -145,8 +145,14 @@ public class BeetsFetcher {
case "id":
item.setID(reader.nextInt());
break;
case "path":
item.setPath(reader.nextString());
case "format":
item.setFormat(reader.nextString());
break;
case "title":
item.setTitle(reader.nextString());
break;
case "artist":
item.setArtist(reader.nextString());
break;
default:
reader.skipValue();

View File

@ -4,6 +4,9 @@ public class Item {
private int id;
private String path;
private String artist;
private String title;
private String format;
public int getID() {
return id;
@ -14,10 +17,32 @@ public class Item {
}
public String getPath() {
return path;
if (path != null) {
return path;
} else {
return "/" + artist + "/" + title + "_" + id + "." + format.toLowerCase();
}
}
public String getArtist() {
return artist;
}
public String getTitle() {
return title;
}
public String getFormat() {
return format;
}
public void setPath(String path) {
this.path = path;
}
public void setTitle(String title) {
this.title = title;
}
public void setFormat(String format) {
this.format = format;
}
public void setArtist(String artist) {
this.artist = artist;
}
}