::
|
|
|
furyx
|
|
|
|
Shitsu
|
: 20, 2009 4:35 am |
|
|
, ./subtitles , ? |
|
|
|
|
|
furyx
|
: 20, 2009 5:03 am |
|
|
Shitsu
, , , . . ;)
, ...
- - .
- , .
- ( )
: | "%ProgramFiles%\mplayer\mplayer.exe" "%~f1" -sub "%~d1%~p1subtitles\%~n1.ass" |
., . |
|
|
|
|
|
Shitsu
|
: 20, 2009 6:01 am |
|
|
furyx
, . , .
- subtitles . , .
? - %~p1\%~n1.ass %~p1subtitles\%~n1.ass, |
|
|
|
|
|
: 28.04.2004 : 84 : -,
|
: 20, 2009 11:13 am |
|
|
Shitsu
:) , .. . , , , , . , , .
, mplayer.c . .
- , root. . :) |
|
|
|
|
|
Shitsu
|
: 20, 2009 15:28 pm |
|
|
, , . :
: | +
|+subtitles
||- 01.srt
||- 02.srt
||- 03.srt
|- 01.avi
|- 02.avi
|- 03.avi
|
, , ( ). , .
|
|
|
|
|
|
: 28.04.2004 : 84 : -,
|
: 20, 2009 15:35 pm |
|
|
subtitles, . Ƹ, , .
Matroska, :) |
|
|
|
|
|
Shitsu
|
: 20, 2009 17:26 pm |
|
|
subreader.c. :
: | char** sub_filenames(const char* path, char *fname)
{
char *f_dir, *f_fname, *f_fname_noext, *f_fname_trim, *tmp, *tmp_sub_id;
char *tmp_fname_noext, *tmp_fname_trim, *tmp_fname_ext, *tmpresult;
int len, pos, found, i, j;
char * sub_exts[] = { "utf", "utf8", "utf-8", "sub", "srt", "smi", "rt", "txt", "ssa", "aqt", "jss", "js", "ass", NULL};
subfn *result;
char **result2;
int subcnt;
FILE *f;
DIR *d;
struct dirent *de;
len = (strlen(fname) > 256 ? strlen(fname) : 256)
+(strlen(path) > 256 ? strlen(path) : 256)+2;
f_dir = malloc(len);
f_fname = malloc(len);
f_fname_noext = malloc(len);
f_fname_trim = malloc(len);
tmp_fname_noext = malloc(len);
tmp_fname_trim = malloc(len);
tmp_fname_ext = malloc(len);
tmpresult = malloc(len);
result = malloc(sizeof(subfn)*MAX_SUBTITLE_FILES);
memset(result, 0, sizeof(subfn)*MAX_SUBTITLE_FILES);
subcnt = 0;
tmp = strrchr(fname,'/');
#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__OS2__)
if(!tmp)tmp = strrchr(fname,'\\');
if(!tmp)tmp = strrchr(fname,':');
#endif
// extract filename & dirname from fname
if (tmp) {
strcpy(f_fname, tmp+1);
pos = tmp - fname;
strncpy(f_dir, fname, pos+1);
f_dir[pos+1] = 0;
} else {
strcpy(f_fname, fname);
strcpy(f_dir, "./");
}
strcpy_strip_ext(f_fname_noext, f_fname);
strcpy_trim(f_fname_trim, f_fname_noext);
tmp_sub_id = NULL;
if (dvdsub_lang && !whiteonly(dvdsub_lang)) {
tmp_sub_id = malloc(strlen(dvdsub_lang)+1);
strcpy_trim(tmp_sub_id, dvdsub_lang);
}
// 0 = nothing
// 1 = any subtitle file
// 2 = any sub file containing movie name
// 3 = sub file containing movie name and the lang extension
for (j = 0; j <= 1; j++) {
d = opendir(j == 0 ? f_dir : path);
if (d) {
while ((de = readdir(d))) {
// retrieve various parts of the filename
strcpy_strip_ext(tmp_fname_noext, de->d_name);
strcpy_get_ext(tmp_fname_ext, de->d_name);
strcpy_trim(tmp_fname_trim, tmp_fname_noext);
// does it end with a subtitle extension?
found = 0;
#ifdef CONFIG_ICONV
#ifdef CONFIG_ENCA
for (i = ((sub_cp && strncasecmp(sub_cp, "enca", 4) != 0) ? 3 : 0); sub_exts[i]; i++) {
#else
for (i = (sub_cp ? 3 : 0); sub_exts[i]; i++) {
#endif
#else
for (i = 0; sub_exts[i]; i++) {
#endif
if (strcasecmp(sub_exts[i], tmp_fname_ext) == 0) {
found = 1;
break;
}
}
// we have a (likely) subtitle file
if (found) {
int prio = 0;
if (!prio && tmp_sub_id)
{
sprintf(tmpresult, "%s %s", f_fname_trim, tmp_sub_id);
mp_msg(MSGT_SUBREADER,MSGL_INFO,"dvdsublang...%s\n", tmpresult);
if (strcmp(tmp_fname_trim, tmpresult) == 0 && sub_match_fuzziness >= 1) {
// matches the movie name + lang extension
prio = 5;
}
}
if (!prio && strcmp(tmp_fname_trim, f_fname_trim) == 0) {
// matches the movie name
prio = 4;
}
if (!prio && (tmp = strstr(tmp_fname_trim, f_fname_trim)) && (sub_match_fuzziness >= 1)) {
// contains the movie name
tmp += strlen(f_fname_trim);
if (tmp_sub_id && strstr(tmp, tmp_sub_id)) {
// with sub_id specified prefer localized subtitles
prio = 3;
} else if ((tmp_sub_id == NULL) && whiteonly(tmp)) {
// without sub_id prefer "plain" name
prio = 3;
} else {
// with no localized subs found, try any else instead
prio = 2;
}
}
if (!prio) {
// doesn't contain the movie name
// don't try in the mplayer subtitle directory
if ((j == 0) && (sub_match_fuzziness >= 2)) {
prio = 1;
}
}
if (prio) {
prio += prio;
#ifdef CONFIG_ICONV
if (i<3){ // prefer UTF-8 coded
prio++;
}
#endif
sprintf(tmpresult, "%s%s", j == 0 ? f_dir : path, de->d_name);
// fprintf(stderr, "%s priority %d\n", tmpresult, prio);
if ((f = fopen(tmpresult, "rt"))) {
fclose(f);
result[subcnt].priority = prio;
result[subcnt].fname = strdup(tmpresult);
subcnt++;
}
}
}
if (subcnt >= MAX_SUBTITLE_FILES) break;
}
closedir(d);
}
}
if (tmp_sub_id) free(tmp_sub_id);
free(f_dir);
free(f_fname);
free(f_fname_noext);
free(f_fname_trim);
free(tmp_fname_noext);
free(tmp_fname_trim);
free(tmp_fname_ext);
free(tmpresult);
qsort(result, subcnt, sizeof(subfn), compare_sub_priority);
result2 = malloc(sizeof(char*)*(subcnt+1));
memset(result2, 0, sizeof(char*)*(subcnt+1));
for (i = 0; i < subcnt; i++) {
result2[i] = result[i].fname;
}
result2[subcnt] = NULL;
free(result);
return result2;
} |
f_dir -
path - (/home/username/.mplayer/sub/ )
,
:
: | strcpy(f_subtitles,f_dir);
strcat(f_subtitles,"subtitles/");
// 0 = nothing
// 1 = any subtitle file
// 2 = any sub file containing movie name
// 3 = sub file containing movie name and the lang extension
for (j = 0; j <= 2; j++) {
if (j==0) d = opendir(f_dir);
if (j==1) d = opendir(path);
if (j==2) d = opendir(f_subtitles);
if (d) { |
: | SUBtiiles: /media/hard/HARD///!RAW/[Zero-Raws] Himawari! - 01-13+clean OP&ED [704x396 DivX6.11 DVD]/subtitles/
Fdir: /media/hard/HARD///!RAW/[Zero-Raws] Himawari! - 01-13+clean OP&ED [704x396 DivX6.11 DVD]/
path: /home/cepera/.mplayer/sub/ |
, -
- " " |
|
|
|
|
|
: 28.04.2004 : 84 : -,
|
: 20, 2009 17:48 pm |
|
|
, ? ./subtitles/, ?
printf-, gdb , . |
|
|
|
|
|
Shitsu
|
: 20, 2009 18:03 pm |
|
|
Fdir: /media/hard/HARD///!RAW/[Zero-Raws] Himawari! - 01-13+clean OP&ED [704x396 DivX6.11 DVD]/
path: /home/cepera/.mplayer/sub/
,
SUBtiiles: /media/hard/HARD///!RAW/[Zero-Raws] Himawari! - 01-13+clean OP&ED [704x396 DivX6.11 DVD]/subtitles/
.
mp_msg() |
|
|
|
|
|
: 28.04.2004 : 84 : -,
|
: 20, 2009 18:10 pm |
|
|
, j, ? |
|
|
|
|
|
furyx
|
: 20, 2009 18:39 pm |
|
|
Shitsu
, ?
- . |
|
|
|
|
|
: 28.04.2004 : 84 : -,
|
: 20, 2009 18:45 pm |
|
|
- pastebin.com . . |
|
|
|
|
|
Shitsu
|
: 20, 2009 19:21 pm |
|
|
http://pastebin.com/m9e36131
http://pastebin.com/m5d7f019d
get_path( "sub/" ); - /home/cepera/.mplayer/sub/
add_subtitles (tmp{i], fps, 1); - , SUB: Added subtitle file (1): /home/cepera/.mplayer/sub/[Zero-Raws] Himawari! - 01 [704x396 DivX6.11 DVD].ass
: 20, 2009 19:38 pm |
|
|
|
|
|
: 28.04.2004 : 84 : -,
|
: 20, 2009 19:25 pm |
|
|
, . , , strcat. |
|
|
|
|
|
|
|
,
|
xm10Ek|:"8.h8RH,(qZ 'X& *?| μT$giX^;*xeeq.
ai#WଵQ0)I2+kt1p UDvX]ׁ5V ..>캇tʙoG0G
b5]/asYwS@^ |