* disable useCreationDate by default

* if useCreationDate  is enabled set the movie release date, not just the year
This commit is contained in:
Reinhard Pointner 2014-04-06 05:35:53 +00:00
parent d8c56c637a
commit cf062bbe44
7 changed files with 16 additions and 15 deletions

View File

@ -15,7 +15,7 @@
# use NTFS extended attributes for storing metadata
-DuseExtendedFileAttributes=true
-DuseCreationDate=true
-DuseCreationDate=false
# look for native libs here
-Djna.library.path="%EXEDIR%"

View File

@ -19,7 +19,7 @@
# use NTFS extended attributes for storing metadata
-DuseExtendedFileAttributes=true
-DuseCreationDate=true
-DuseCreationDate=false
# look for native libs here
-Djna.library.path="%EXEDIR%"

View File

@ -23,7 +23,7 @@
# use NTFS extended attributes for storing metadata
-DuseExtendedFileAttributes=true
-DuseCreationDate=true
-DuseCreationDate=false
# look for native libs here
-Djna.library.path="%EXEDIR%"

View File

@ -202,7 +202,7 @@ public class MediaBindingBean {
@Define("primaryTitle")
public String getPrimaryTitle() throws Exception {
if (infoObject instanceof Movie) {
return WebServices.TMDb.getMovieInfo(getMovie(), Locale.ENGLISH).getName();
return WebServices.TMDb.getMovieInfo(getMovie(), Locale.ENGLISH, false).getName();
}
if (infoObject instanceof Episode) {
@ -228,7 +228,7 @@ public class MediaBindingBean {
}
// lookup IMDbID for TMDbID
tmdbid = WebServices.TMDb.getMovieInfo(getMovie(), null).getId();
tmdbid = WebServices.TMDb.getMovieInfo(getMovie(), Locale.ENGLISH, false).getId();
}
return String.valueOf(tmdbid);
@ -244,7 +244,7 @@ public class MediaBindingBean {
}
// lookup IMDbID for TMDbID
imdbid = WebServices.TMDb.getMovieInfo(getMovie(), null).getImdbId();
imdbid = WebServices.TMDb.getMovieInfo(getMovie(), Locale.ENGLISH, false).getImdbId();
}
return String.format("tt%07d", imdbid);
@ -515,7 +515,7 @@ public class MediaBindingBean {
if (infoObject instanceof Episode)
metaInfo = WebServices.TheTVDB.getSeriesInfoByName(((Episode) infoObject).getSeriesName(), Locale.ENGLISH);
if (infoObject instanceof Movie)
metaInfo = WebServices.TMDb.getMovieInfo(getMovie(), Locale.ENGLISH);
metaInfo = WebServices.TMDb.getMovieInfo(getMovie(), Locale.ENGLISH, true);
} catch (Exception e) {
throw new RuntimeException("Failed to retrieve metadata: " + infoObject, e);
}
@ -534,7 +534,7 @@ public class MediaBindingBean {
}
if (infoObject instanceof Movie) {
Movie m = getMovie();
data = WebServices.IMDb.getImdbApiMovieInfo(m.getImdbId() > 0 ? m : new Movie(null, -1, WebServices.TMDb.getMovieInfo(getMovie(), Locale.ENGLISH).getImdbId(), -1));
data = WebServices.IMDb.getImdbApiMovieInfo(m.getImdbId() > 0 ? m : new Movie(null, -1, WebServices.TMDb.getMovieInfo(getMovie(), Locale.ENGLISH, false).getImdbId(), -1));
}
} catch (Exception e) {
throw new RuntimeException("Failed to retrieve metadata: " + infoObject, e);

View File

@ -1390,8 +1390,9 @@ public class MediaDetection {
}
} else if (model instanceof Movie) {
Movie movie = (Movie) model;
if (movie.getYear() > 0) {
xattr.setCreationDate(new Date(movie.getYear(), 1, 1).getTimeStamp());
if (movie.getYear() > 0 && movie.getTmdbId() > 0) {
Date releaseDate = WebServices.TMDb.getMovieInfo(movie, Locale.ENGLISH, false).getReleased();
xattr.setCreationDate(releaseDate.getTimeStamp());
}
}
} catch (Exception e) {

View File

@ -148,15 +148,15 @@ public class TMDbClient implements MovieIdentificationService {
throw new UnsupportedOperationException();
}
public MovieInfo getMovieInfo(Movie movie, Locale locale) throws IOException {
public MovieInfo getMovieInfo(Movie movie, Locale locale, boolean extendedInfo) throws IOException {
if (movie.getTmdbId() >= 0) {
return getMovieInfo(String.valueOf(movie.getTmdbId()), locale, true, true);
return getMovieInfo(String.valueOf(movie.getTmdbId()), locale, extendedInfo, extendedInfo);
} else if (movie.getImdbId() >= 0) {
return getMovieInfo(String.format("tt%07d", movie.getImdbId()), locale, true, true);
return getMovieInfo(String.format("tt%07d", movie.getImdbId()), locale, extendedInfo, extendedInfo);
} else {
for (Movie result : searchMovie(movie.getName(), locale)) {
if (movie.getName().equalsIgnoreCase(result.getName()) && movie.getYear() == result.getYear()) {
return getMovieInfo(String.valueOf(result.getTmdbId()), locale, true, true);
return getMovieInfo(String.valueOf(result.getTmdbId()), locale, extendedInfo, extendedInfo);
}
}
}

View File

@ -49,7 +49,7 @@ public class TMDbClientTest {
@Test
public void getMovieInfo() throws Exception {
MovieInfo movie = tmdb.getMovieInfo(new Movie(null, 0, 418279, -1), Locale.ENGLISH);
MovieInfo movie = tmdb.getMovieInfo(new Movie(null, 0, 418279, -1), Locale.ENGLISH, true);
assertEquals("Transformers", movie.getName());
assertEquals("2007-07-02", movie.getReleased().toString());