Skip to content

Commit

Permalink
Fixed artwork detection when video disabled in the layout script
Browse files Browse the repository at this point in the history
Also changed artwork scraping so that snap images get scraped even
if there is already a video for that game
  • Loading branch information
mickelson committed Sep 20, 2015
1 parent cd67e60 commit 334b2ec
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/fe_build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ bool FeSettings::mamedb_scraper( FeImporterContext &c )
taskc++;
}

if ( m_scrape_snaps && !has_artwork( *itr, "snap" ) )
if ( m_scrape_snaps && !has_image_artwork( *itr, "snap" ) )
{
const char *SNAP = "snap/";
std::string fname = base_path + SNAP + (*itr).get_info( FeRomInfo::Romname );
Expand Down Expand Up @@ -623,7 +623,7 @@ bool FeSettings::thegamesdb_scraper( FeImporterContext &c )
if ( !c.scrape_art || m_scrape_fanart
|| ( m_scrape_flyers && (!has_artwork( *itr, "flyer" ) ) )
|| ( m_scrape_wheels && (!has_artwork( *itr, "wheel" ) ) )
|| ( m_scrape_snaps && (!has_artwork( *itr, "snap" ) ) )
|| ( m_scrape_snaps && (!has_image_artwork( *itr, "snap" ) ) )
|| ( m_scrape_marquees && (!has_artwork( *itr, "marquee" ) ) ) )
worklist.push_back( &(*itr) );
}
Expand Down Expand Up @@ -739,7 +739,7 @@ bool FeSettings::thegamesdb_scraper( FeImporterContext &c )
else
done_count++;

if ( m_scrape_snaps && (!my_art.snap.empty() ) && (!has_artwork( rom, "snap" )) )
if ( m_scrape_snaps && (!my_art.snap.empty() ) && (!has_image_artwork( rom, "snap" )) )
{
const char *SNAP = "snap/";
std::string fname = base_path + SNAP + rom.get_info( FeRomInfo::Romname );
Expand Down
3 changes: 2 additions & 1 deletion src/fe_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,8 @@ void FeTextureContainer::internal_update_selection( FeSettings *feSettings )
if ( !feSettings->get_best_artwork_file( *rom,
m_art_name,
vid_list,
image_list ) )
image_list,
(m_video_flags & VF_DisableVideo) ) )
{
// check for layout fallback images/videos
std::string layout_path;
Expand Down
20 changes: 14 additions & 6 deletions src/fe_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2646,7 +2646,8 @@ bool FeSettings::get_best_artwork_file(
const FeRomInfo &rom,
const std::string &art_name,
std::vector<std::string> &vid_list,
std::vector<std::string> &image_list )
std::vector<std::string> &image_list,
bool image_only )
{
const std::string &emu_name = rom.get_info( FeRomInfo::Emulator );

Expand Down Expand Up @@ -2692,7 +2693,7 @@ bool FeSettings::get_best_artwork_file(
if ( gather_artwork_filenames( art_paths, romname, vid_list, romname_image_list ) )
{
// test for "romname" specific videos first
if ( !vid_list.empty() )
if ( !image_only && !vid_list.empty() )
return true;
}

Expand All @@ -2702,7 +2703,7 @@ bool FeSettings::get_best_artwork_file(
if ( check_altname && gather_artwork_filenames( art_paths, altname, vid_list, altname_image_list ) )
{
// test for "altname" specific videos second
if ( !vid_list.empty() )
if ( !image_only && !vid_list.empty() )
return true;
}

Expand All @@ -2712,7 +2713,7 @@ bool FeSettings::get_best_artwork_file(
if ( check_cloneof && gather_artwork_filenames( art_paths, cloneof, vid_list, cloneof_image_list ) )
{
// then "cloneof" specific videos
if ( !vid_list.empty() )
if ( !image_only && !vid_list.empty() )
return true;
}

Expand Down Expand Up @@ -2748,16 +2749,23 @@ bool FeSettings::get_best_artwork_file(
bool FeSettings::has_artwork( const FeRomInfo &rom, const std::string &art_name )
{
std::vector<std::string> temp1, temp2;
return ( get_best_artwork_file( rom, art_name, temp1, temp2 ) );
return ( get_best_artwork_file( rom, art_name, temp1, temp2, false ) );
}

bool FeSettings::has_video_artwork( const FeRomInfo &rom, const std::string &art_name )
{
std::vector<std::string> vids, temp;
get_best_artwork_file( rom, art_name, vids, temp );
get_best_artwork_file( rom, art_name, vids, temp, false );
return (!vids.empty());
}

bool FeSettings::has_image_artwork( const FeRomInfo &rom, const std::string &art_name )
{
std::vector<std::string> temp, images;
get_best_artwork_file( rom, art_name, temp, images, true );
return (!images.empty());
}

bool FeSettings::get_best_dynamic_image_file(
int filter_index,
int rom_index,
Expand Down
4 changes: 3 additions & 1 deletion src/fe_settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,12 @@ class FeSettings : public FeBaseConfigurable
const FeRomInfo &rom,
const std::string &art_name,
std::vector<std::string> &vid_list,
std::vector<std::string> &image_list );
std::vector<std::string> &image_list,
bool image_only );

bool has_artwork( const FeRomInfo &rom, const std::string &art_name );
bool has_video_artwork( const FeRomInfo &rom, const std::string &art_name );
bool has_image_artwork( const FeRomInfo &rom, const std::string &art_name );

bool get_best_dynamic_image_file(
int filter_index,
Expand Down
3 changes: 2 additions & 1 deletion src/fe_vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,8 @@ const char *FeVM::cb_get_art( const char *art, int index_offset, int filter_offs
*rom,
art,
vid_list,
image_list ) ))
image_list,
(art_flags&AF_ImagesOnly) ) ))
{
if ( !(art_flags&AF_ImagesOnly) && !vid_list.empty() )
retval = vid_list.front();
Expand Down

0 comments on commit 334b2ec

Please sign in to comment.