/* Given an audio's file name, load lyrics from the default lyrics file name. */ void lyrics_autoload (const char *filename) { char *lyrics_filename, *extn; assert (!raw_lyrics); assert (lyrics_message); if (filename == NULL) { lyrics_message = "[No file playing!]"; return; } if (!options_get_bool ("AutoLoadLyrics")) { lyrics_message = "[Lyrics not autoloaded!]"; return; } if (is_url (filename)) { lyrics_message = "[Lyrics from URL is not supported!]"; return; } lyrics_filename = xstrdup (filename); extn = ext_pos (lyrics_filename); if (extn) { *--extn = '\0'; raw_lyrics = lyrics_load_file (lyrics_filename); } else lyrics_message = "[No lyrics file!]"; free (lyrics_filename); }
int is_plist_file (const char *name) { const char *ext = ext_pos (name); if (ext && (!strcasecmp(ext, "m3u") || !strcasecmp(ext, "pls"))) return 1; return 0; }
static void asap_get_name(const char *file, char buf[4]) { const char *ext = ext_pos(file); int i = 0; while (ext[i] != '\0' && i < 3) { int c = ext[i]; if (c >= 'a' && c <= 'z') c += 'A' - 'a'; buf[i++] = c; } buf[i] = '\0'; }
static void ffmpeg_get_name (const char *file, char buf[4]) { char *ext = ext_pos (file); if (!strcasecmp(ext, "ra")) strcpy (buf, "RA"); else if (!strcasecmp(ext, "wma")) strcpy (buf, "WMA"); else if (!strcasecmp(ext, "mp4")) strcpy (buf, "MP4"); else if (!strcasecmp(ext, "m4a")) strcpy (buf, "M4A"); }
/* Find the index in plugins table for the given file. * Return -1 if not found. */ static int find_type (const char *file) { int result = -1; char *extn, *mime; extn = ext_pos (file); mime = NULL; result = find_decoder (extn, file, &mime); free (mime); return result; }
/* The playlist may have deleted items. */ int plist_load (struct plist *plist, const char *fname, const char *cwd, const int load_serial) { int num; int read_tags = options_get_int ("ReadTags"); const char *ext = ext_pos (fname); if (ext && !strcasecmp(ext, "pls")) num = plist_load_pls (plist, fname, cwd); else num = plist_load_m3u (plist, fname, cwd, load_serial); if (read_tags) switch_titles_tags (plist); else switch_titles_file (plist); return num; }