-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from NETHeader/develop
Merging develop into master
- Loading branch information
Showing
5 changed files
with
70 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
*.class | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.ear | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
#Maven | ||
cache | ||
target | ||
release.properties | ||
pom.xml.* | ||
|
||
#IntelliJ IDEA | ||
.idea/ | ||
*.iml | ||
|
||
#Eclipse | ||
.classpath | ||
.project | ||
.settings | ||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ | |
* Implements scraping of meta data, artwork and trailers. | ||
* | ||
* @author NETHead <[email protected]> | ||
* @version 0.1 | ||
* @version 0.2 | ||
* @see IMediaMetadataProvider | ||
* @see IMediaArtworkProvider | ||
* @see IMediaTrailerProvider | ||
|
@@ -57,9 +57,8 @@ | |
@PluginImplementation | ||
public class AebnMetadataProvider implements IMovieMetadataProvider, IMediaArtworkProvider, IMovieTrailerProvider { | ||
private static AebnMetadataProvider instance; | ||
private static final String AEBNID = "AebnId"; | ||
private static MediaProviderInfo providerInfo = new MediaProviderInfo(AEBNID, "aebn.net", | ||
"Media scraper for the Adult Entertainment Broadcast Network (AEBN)"); | ||
private static final String AEBNID = "AebnID"; | ||
private static MediaProviderInfo providerInfo = createMediaProviderInfo(); | ||
private static final Logger LOGGER = LoggerFactory.getLogger(AebnMetadataProvider.class); | ||
private static final String BASE_DATAURL = "http://theater.aebn.net"; | ||
private static final String BASE_IMGURL = "http://pic.aebn.net"; | ||
|
@@ -80,6 +79,15 @@ public MediaProviderInfo getProviderInfo() { | |
return providerInfo; | ||
} | ||
|
||
private static MediaProviderInfo createMediaProviderInfo() { | ||
MediaProviderInfo providerInfo = new MediaProviderInfo( | ||
AEBNID, | ||
"aebn.net", | ||
"<html><h3>Adult Entertainment Broadcast Network</h3><br />An adult movie database. This scraper is able to scrape metadata and artwork.</html>", | ||
AebnMetadataProvider.class.getResource("/aebn_net.png")); | ||
return providerInfo; | ||
} | ||
|
||
/** | ||
* Search for movies at aebn.net. | ||
* | ||
|
@@ -195,7 +203,7 @@ public MediaMetadata getMetadata(MediaScrapeOptions options) throws Exception { | |
LOGGER.debug("AEBN: getMetadata() {}", options); | ||
|
||
// check if there is already meta data present in the result | ||
if (options.getResult() != null && options.getResult().getMediaMetadata() != null) { | ||
if ((options.getResult() != null) && (options.getResult().getMediaMetadata() != null)) { | ||
LOGGER.debug("AEBN: return metadata from cache"); | ||
return options.getResult().getMediaMetadata(); | ||
} | ||
|
@@ -205,19 +213,19 @@ public MediaMetadata getMetadata(MediaScrapeOptions options) throws Exception { | |
Element element = null; | ||
Integer aebnId = 0; | ||
|
||
// get aebnId from previous search result | ||
// get AebnId from previous search result | ||
if ((options.getResult() != null) && (options.getResult().getId() != null)) { | ||
aebnId = Integer.parseInt(options.getResult().getId()); | ||
LOGGER.debug("AEBN: got aebnId({}) from previous search result", aebnId); | ||
LOGGER.debug("AEBN: aebnId() from previous search result = {}", aebnId); | ||
// preset some values from search result (if there is one) | ||
// Use core.Utils.RemoveSortableName() if you want eg "Bourne Legacy, The" -> "The Bourne Legacy". | ||
md.storeMetadata(MediaMetadata.ORIGINAL_TITLE, StrgUtils.removeCommonSortableName(options.getResult().getOriginalTitle())); | ||
md.storeMetadata(MediaMetadata.TITLE, StrgUtils.removeCommonSortableName(options.getResult().getTitle())); | ||
} | ||
|
||
// or get aebnId from options | ||
if (!isValidAebnId(aebnId)) { | ||
LOGGER.debug("AEBN: got aebnId({}) from options", options.getId(AEBNID)); | ||
// or get AebnId from options | ||
if (!isValidAebnId(aebnId) && (options.getId(AEBNID) != null)) { | ||
LOGGER.debug("AEBN: aebnId() from options = {}", options.getId(AEBNID)); | ||
aebnId = Integer.parseInt(options.getId(AEBNID)); | ||
} | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,31 +11,31 @@ | |
* A test class for scraping aebn.net. | ||
* | ||
* @author NETHead <[email protected]> | ||
* @version 0.1 | ||
* @version 0.2 | ||
* @see AebnMetadataProvider | ||
* | ||
*/ | ||
public class AebnMetadataProviderTest { | ||
|
||
@Test | ||
public void testSearch() { | ||
@Test | ||
public void testSearch() throws Exception { | ||
try { | ||
IMovieMetadataProvider aebn = new AebnMetadataProvider(); | ||
MediaSearchOptions options = new MediaSearchOptions(MediaType.MOVIE); | ||
|
||
options.set(SearchParam.QUERY, "Erotic Massage Stories 5"); | ||
IMovieMetadataProvider aebn = new AebnMetadataProvider(); | ||
MediaSearchOptions options = new MediaSearchOptions(MediaType.MOVIE); | ||
|
||
List<MediaSearchResult> results = aebn.search(options); | ||
assertThat(results.size()).isEqualTo(60); | ||
options.set(SearchParam.QUERY, "Erotic Massage Stories 5"); | ||
List<MediaSearchResult> results = aebn.search(options); | ||
assertThat(results.size()).isEqualTo(60); | ||
} | ||
catch (Exception e) { | ||
e.printStackTrace(); | ||
Assert.fail(); | ||
System.err.println(e.getMessage()); | ||
e.printStackTrace(); | ||
Assert.fail(); | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
public void testScrape() throws Exception { | ||
@Test | ||
public void testScrapeData() throws Exception { | ||
try { | ||
IMovieMetadataProvider aebn = new AebnMetadataProvider(); | ||
MediaScrapeOptions options = new MediaScrapeOptions(MediaType.MOVIE); | ||
|
@@ -52,15 +52,16 @@ public void testScrape() throws Exception { | |
assertThat(md.getStringValue(MediaMetadata.PRODUCTION_COMPANY)).isEqualTo("Pure Passion"); | ||
assertThat(md.getStringValue(MediaMetadata.TMDBID)).isEqualTo(""); | ||
assertThat(md.getStringValue(MediaMetadata.IMDBID)).isEqualTo(""); | ||
assertThat(md.getStringValue(MediaMetadata.RUNTIME)).isEqualTo(145); | ||
assertThat(md.getGenres().size()).isEqualTo(8); | ||
assertThat(md.getStringValue(MediaMetadata.RUNTIME)).isEqualTo("145"); | ||
assertThat(md.getGenres().size()).isEqualTo(7); | ||
assertThat(md.getGenres().contains(MediaGenres.EROTIC)).isTrue(); | ||
assertThat(md.getStringValue(MediaMetadata.COLLECTION_NAME)).isEqualTo("Erotic Massage Stories"); | ||
assertThat(md.getCastMembers().size()).isEqualTo(8); // Don't forget to add actor + director! | ||
assertThat(md.getCastMembers().size()).isEqualTo(8); // Don't forget to add actor + director to this number! | ||
} | ||
catch (Exception e) { | ||
e.printStackTrace(); | ||
Assert.fail(); | ||
System.err.println(e.getMessage()); | ||
e.printStackTrace(); | ||
Assert.fail(); | ||
} | ||
} | ||
} | ||
} |