Page 1 of 1
MovieProperty "year"?
Posted: 28 Aug 2013, 20:25
by Yannik
Why isn't there a MovieProperty "year"?
IMDB does return year (see
http://www.omdbapi.com/?i=tt1287357) but it can't be used because its not in the MovieInfo. If release date is unknown (as in my example linked before), I can't even use the release date as year.
Apart from this, I cannot seem to see a way how to get Info on the Year of movie if you just have the movie id.
Re: MovieProperty "year"?
Posted: 29 Aug 2013, 01:31
by rednoah
You mean {y} ???
Re: MovieProperty "year"?
Posted: 29 Aug 2013, 01:35
by rednoah
I'm pretty sure the {imdb} object contains the release date. I think if you just enter {imdb} in the editor it'll show you the a avilable properties. Maybe ReleaseDate, ReleaseYear or something.
Re: MovieProperty "year"?
Posted: 29 Aug 2013, 06:03
by Yannik
No no, I mean when having a script like this:
Code: Select all
IMDBID = 1287357
movieObject = new net.sourceforge.filebot.web.Movie("", -1, IMDBID, -1)
movieInfo = net.sourceforge.filebot.WebServices.IMDb.getImdbApiMovieInfo(movieObject)
println movieInfo.getYear()
->
Aug 29, 2013 8:08:31 AM net.sourceforge.filebot.web.Date parse
WARNING: Unparseable date: "N/A"
MissingMethodException: No signature of method: net.sourceforge.filebot.web.TMDbClient$MovieInfo.getYear() is applicable for argument types: () values: []
Possible solutions: getAt(java.lang.String), getClass(), getCast(), getGenres(), getId(), getName()
groovy.lang.MissingMethodException: No signature of method: net.sourceforge.filebot.web.TMDbClient$MovieInfo.getYear() is applicable for argument types: () values: []
Re: MovieProperty "year"?
Posted: 29 Aug 2013, 12:51
by rednoah
You're using this:
http://code.ohloh.net/file?fid=cCauLbWm ... =true#L211
So the method you're looking for is
MovieInfo.getReleased().
But in your case you might wanna get the raw data not parsed into filebot objects:
http://code.ohloh.net/file?fid=cCauLbWm ... =true#L185
That one works by id or name/year.
PS: I seem to get your two threads mixed up.

Re: MovieProperty "year"?
Posted: 29 Aug 2013, 15:06
by Yannik
Hi there,
sure I can just code a custom method. but wouldn't it be best to have it integrated in the getImdbApiMovieInfo() function of filebot?
Re: MovieProperty "year"?
Posted: 29 Aug 2013, 22:45
by rednoah
There is something like the for the TMDb side which is used internally alot, look into TMDbClient.getMovieInfo. The IMDb stuff is not my primary datasource.
Re: MovieProperty "year"?
Posted: 30 Aug 2013, 04:29
by Yannik
I also use TMDbClient.getMovieInfo as my primary data source, I only use IMDB if TMDB has no data for the specific movie. (See
http://www.filebot.net/forums/viewtopic ... 5679#p5679)
So can you add it? I think many people use the process "Check TMDB"->"Use IMDB if TMDB has no data" and it's only a small addition

Re: MovieProperty "year"?
Posted: 30 Aug 2013, 06:41
by rednoah
Yeah, but doesn't that already work with scripting. Two -rename --db tmdb/imdb calls should do it.
Looking at you hooking into my classes youre already far more advanced than that.

Re: MovieProperty "year"?
Posted: 01 Sep 2013, 08:50
by Yannik
Yeah, I wrote my own script which creates some extra files for each movies etc.
Can you add the year property to IMDb.getImdbApiMovieInfo so I can flawlessly integrate it with TMDb.getMovieInfo?
Code: Select all
def getMovieInfo(movie,locale) {
movieInfo = null
if (!(movie.getTmdbId() > 0)) {
try {
movieInfo = net.sourceforge.filebot.WebServices.TMDb.getMovieInfo(movie, locale)
} catch (FileNotFoundException e) {
movieInfo = net.sourceforge.filebot.WebServices.IMDb.getImdbApiMovieInfo(movie)
}
} else {
movieInfo = net.sourceforge.filebot.WebServices.TMDb.getMovieInfo(movie, locale)
}
return movieInfo
}
Thanks

Re: MovieProperty "year"?
Posted: 01 Sep 2013, 09:28
by rednoah
Tested via the format and this {imdb.released.year} works. TMDb.getMovieInfo and IMDb.getImdbApiMovieInfo both give you the same MovieInfo object so accessing movieInfo.released.year should work for both.
Re: MovieProperty "year"?
Posted: 01 Sep 2013, 11:32
by Yannik
Yeah, but if no "released" date is set it doesn't work. See this for example:
http://www.omdbapi.com/?i=tt1287357 - "Released: N/A" and "Year: 2008".
This is why I want the "year" property to be available in MovieInfo. Like this: {imdb.year}
Maybe this is a corner case, but it would still be great to be solved

Re: MovieProperty "year"?
Posted: 01 Sep 2013, 16:13
by rednoah
I see. The priority is TheMovieDB and that always has a release date. Otherwise the original movie (search result) object should already have the year property that you can fall back to.
Re: MovieProperty "year"?
Posted: 03 Sep 2013, 11:23
by Yannik
I don't have a movie object, only a IMDB-ID as an Integer.
The following patches should do it:
TMDbClient.java.new:
Code: Select all
*** TMDbClient.java 2013-08-27 15:30:00.912850459 +0200
--- TMDbClient.java.new 2013-09-03 13:27:44.539592534 +0200
***************
*** 296,302 ****
public static class MovieInfo implements Serializable {
public static enum MovieProperty {
! adult, backdrop_path, budget, homepage, id, imdb_id, original_title, overview, popularity, poster_path, release_date, revenue, runtime, tagline, title, vote_average, vote_count, certification, collection
}
protected Map<MovieProperty, String> fields;
--- 296,302 ----
public static class MovieInfo implements Serializable {
public static enum MovieProperty {
! adult, backdrop_path, budget, homepage, id, imdb_id, original_title, overview, popularity, poster_path, release_date, revenue, runtime, tagline, title, vote_average, vote_count, certification, collection, year
}
protected Map<MovieProperty, String> fields;
IMDbClient.java.new:
Code: Select all
*** IMDbClient.java 2013-08-27 15:30:00.912850459 +0200
--- IMDbClient.java.new 2013-09-03 13:28:47.000000000 +0200
***************
*** 218,223 ****
--- 218,224 ----
}
Map<MovieProperty, String> fields = new EnumMap<MovieProperty, String>(MovieProperty.class);
+ fields.put(MovieProperty.year, data.get("year"));
fields.put(MovieProperty.title, data.get("title"));
fields.put(MovieProperty.certification, data.get("rated"));
fields.put(MovieProperty.runtime, data.get("runtime"));
Apply like this:
Code: Select all
patch -i TMDbClient.java.new
patch -i IMDbClient.java.new
Re: MovieProperty "year"?
Posted: 03 Sep 2013, 12:27
by rednoah
I don't like that patch, but since it's so important I fixed it for you with r1709 the way i think is best. Basically it's trying to use release date if possible but falling back to the year field and then just using the year-01-01 as release date, so you'll can always use movieInfo.released.year
Re: MovieProperty "year"?
Posted: 03 Sep 2013, 12:34
by Yannik
thanks
Re: MovieProperty "year"?
Posted: 03 Sep 2013, 13:20
by Yannik
Actually, FileBot.jar in current HEAD does only seem to contain revision 1708?
Code: Select all
$java -jar FileBot.jar -version
FileBot 3.62 (r1708) / Java(TM) SE Runtime Environment 1.7.0_10
Re: MovieProperty "year"?
Posted: 03 Sep 2013, 14:58
by rednoah
Uploaded it for u just now.
Re: MovieProperty "year"?
Posted: 03 Sep 2013, 15:02
by Yannik
thanks

Re: MovieProperty "year"?
Posted: 03 Sep 2013, 15:13
by Yannik
Another small thing I have noticed is, that you should check if released actually is a parsable date or atleast compress warnings as else this error is going to appear:
Code: Select all
Sep 03, 2013 5:10:11 PM net.sourceforge.filebot.web.Date parse
WARNING: Unparseable date: "N/A"
Sep 03, 2013 5:10:11 PM net.sourceforge.filebot.web.Date parse
WARNING: Unparseable date: "N/A"
Re: MovieProperty "year"?
Posted: 08 Sep 2013, 17:17
by Yannik
Can you check that? Thanks

Re: MovieProperty "year"?
Posted: 09 Sep 2013, 02:04
by rednoah
I think I disabled those warnings in the recent revisions already.