Mercurial > audlegacy
comparison Plugins/Input/console/Audacious_Driver.cpp @ 1242:0f89ebbf890a trunk
[svn] - get_song_tuple() implementation (scrobblerific!)
| author | nenolod |
|---|---|
| date | Wed, 14 Jun 2006 23:19:56 -0700 |
| parents | f1e57db353a3 |
| children | 7c765d74d643 |
comparison
equal
deleted
inserted
replaced
| 1241:924181beaa91 | 1242:0f89ebbf890a |
|---|---|
| 505 *title = end_get_info( info, length, 0 ); | 505 *title = end_get_info( info, length, 0 ); |
| 506 | 506 |
| 507 g_free(path2); | 507 g_free(path2); |
| 508 } | 508 } |
| 509 | 509 |
| 510 // Get tuple | |
| 511 | |
| 512 static TitleInput *get_song_tuple( char *path ) | |
| 513 { | |
| 514 int track = 0; // to do: way to select other tracks | |
| 515 | |
| 516 // extract the subsong id from the virtual path | |
| 517 gchar *path2 = g_strdup(path); | |
| 518 gchar *_path = strchr(path2, '?'); | |
| 519 | |
| 520 if (_path != NULL && *_path == '?') | |
| 521 { | |
| 522 *_path = '\0'; | |
| 523 _path++; | |
| 524 track = atoi(_path); | |
| 525 } | |
| 526 | |
| 527 Audacious_Reader in; | |
| 528 tag_t tag; | |
| 529 if ( in.open( path2 ) || in.read( tag, sizeof tag ) ) | |
| 530 return NULL; | |
| 531 | |
| 532 int type = identify_file( path2, tag ); | |
| 533 if ( !type ) | |
| 534 return NULL; | |
| 535 | |
| 536 track_info_t info; | |
| 537 if ( begin_get_info( path2, &info ) ) | |
| 538 return NULL; | |
| 539 info.track = track; | |
| 540 | |
| 541 switch ( type ) | |
| 542 { | |
| 543 case type_nsf: get_info_t( tag, in, &info, (Nsf_Emu::header_t*) 0 ); break; | |
| 544 case type_gbs: get_info_t( tag, in, &info, (Gbs_Emu::header_t*) 0 ); break; | |
| 545 case type_gym: get_info_t( tag, in, &info, (Gym_Emu::header_t*) 0 ); break; | |
| 546 case type_vgm: get_info_t( tag, in, &info, (Vgm_Emu::header_t*) 0 ); break; | |
| 547 case type_spc: get_info_t( tag, in, &info, (Spc_Emu::header_t*) 0 ); break; | |
| 548 case type_nsfe:get_info_t( tag, in, &info, (Nsfe_Emu::header_t*)0 ); break; | |
| 549 } | |
| 550 | |
| 551 return info.ti; | |
| 552 } | |
| 553 | |
| 510 // Playback | 554 // Playback |
| 511 | 555 |
| 512 static void* play_loop_track( gpointer ) | 556 static void* play_loop_track( gpointer ) |
| 513 { | 557 { |
| 514 g_static_mutex_lock( &playback_mutex ); | 558 g_static_mutex_lock( &playback_mutex ); |
| 810 NULL, | 854 NULL, |
| 811 NULL, | 855 NULL, |
| 812 NULL, | 856 NULL, |
| 813 get_song_info, | 857 get_song_info, |
| 814 NULL, | 858 NULL, |
| 815 NULL | 859 NULL, |
| 860 get_song_tuple, | |
| 816 }; | 861 }; |
| 817 | 862 |
| 818 extern "C" InputPlugin *get_iplugin_info(void) | 863 extern "C" InputPlugin *get_iplugin_info(void) |
| 819 { | 864 { |
| 820 console_ip.description = g_strdup_printf(_("SPC, VGM, NSF/NSFE, GBS, and GYM module decoder")); | 865 console_ip.description = g_strdup_printf(_("SPC, VGM, NSF/NSFE, GBS, and GYM module decoder")); |
