Check forceBastp and use own ID3v2 reader if true
Also sync with bastp head to get additional vorbis <-> id3v2 mappings
This commit is contained in:
parent
51a4c0ffeb
commit
56154f21bd
@ -214,6 +214,10 @@ public class MediaMetadataExtractor extends HashMap<String, ArrayList<String>> {
|
||||
* True if we consider the file to be a good media item
|
||||
*/
|
||||
private boolean mIsMediaFile = false;
|
||||
/**
|
||||
* True if we should try bastp for 'experimental' formats
|
||||
*/
|
||||
private boolean mForceBastp = false;
|
||||
|
||||
/**
|
||||
* Constructor for MediaMetadataExtractor
|
||||
@ -221,6 +225,17 @@ public class MediaMetadataExtractor extends HashMap<String, ArrayList<String>> {
|
||||
* @param path the path to scan
|
||||
*/
|
||||
public MediaMetadataExtractor(String path) {
|
||||
this(path, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for MediaMetadataExtractor
|
||||
*
|
||||
* @param path the path to scan
|
||||
* @param forceBastp always prefer bastp if possible
|
||||
*/
|
||||
public MediaMetadataExtractor(String path, boolean forceBastp) {
|
||||
mForceBastp = forceBastp;
|
||||
extractMetadata(path);
|
||||
}
|
||||
|
||||
@ -293,10 +308,17 @@ public class MediaMetadataExtractor extends HashMap<String, ArrayList<String>> {
|
||||
case "OPUS":
|
||||
populateSelf(bastpTags);
|
||||
break;
|
||||
case "MP3/ID3v2":
|
||||
// ^-- these tagreaders are not fully stable, but can be enabled on demand
|
||||
if(mForceBastp) {
|
||||
populateSelf(bastpTags);
|
||||
break;
|
||||
}
|
||||
// else: fallthrough
|
||||
default:
|
||||
populateSelf(mediaTags);
|
||||
convertNumericGenre();
|
||||
}
|
||||
convertNumericGenre();
|
||||
|
||||
// We consider this a media file if it has some common tags OR
|
||||
// if bastp was able to parse it (which is stricter than Androids own parser)
|
||||
|
@ -408,7 +408,7 @@ public class MediaScanner implements Handler.Callback {
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
MediaMetadataExtractor tags = new MediaMetadataExtractor(path);
|
||||
MediaMetadataExtractor tags = new MediaMetadataExtractor(path, prefs.forceBastp);
|
||||
if (!tags.isMediaFile()) {
|
||||
mustInsert = false; // does not have any useable metadata: won't insert even if it is a playable file
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2016 Adrian Ulrich <adrian@blinkenlights.ch>
|
||||
* Copyright (C) 2017 Google Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -115,6 +116,10 @@ public class ID3v2File extends Common {
|
||||
lu.put("TIT2", "TITLE");
|
||||
lu.put("TALB", "ALBUM");
|
||||
lu.put("TPE1", "ARTIST");
|
||||
lu.put("TYER", "YEAR");
|
||||
lu.put("TRCK", "TRACKNUMBER");
|
||||
lu.put("TCON", "GENRE");
|
||||
lu.put("TCOM", "COMPOSER");
|
||||
|
||||
if(lu.containsKey(k)) {
|
||||
/* A normal, known key: translate into Ogg-Frame name */
|
||||
|
Loading…
x
Reference in New Issue
Block a user