mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 08:48:51 -05:00
* format subtitle name with language id
This commit is contained in:
parent
7c19e15e3e
commit
210a8c0388
@ -54,6 +54,7 @@ import javax.swing.table.DefaultTableCellRenderer;
|
|||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import net.sourceforge.filebot.Analytics;
|
import net.sourceforge.filebot.Analytics;
|
||||||
import net.sourceforge.filebot.ResourceManager;
|
import net.sourceforge.filebot.ResourceManager;
|
||||||
|
import net.sourceforge.filebot.ui.Language;
|
||||||
import net.sourceforge.filebot.web.SubtitleDescriptor;
|
import net.sourceforge.filebot.web.SubtitleDescriptor;
|
||||||
import net.sourceforge.filebot.web.VideoHashSubtitleService;
|
import net.sourceforge.filebot.web.VideoHashSubtitleService;
|
||||||
import net.sourceforge.tuned.FileUtilities;
|
import net.sourceforge.tuned.FileUtilities;
|
||||||
@ -533,7 +534,10 @@ class VideoHashSubtitleDownloadDialog extends JDialog {
|
|||||||
if (selectedOption == null)
|
if (selectedOption == null)
|
||||||
throw new IllegalStateException("Selected option must not be null");
|
throw new IllegalStateException("Selected option must not be null");
|
||||||
|
|
||||||
return new File(videoFile.getParentFile(), FileUtilities.getName(videoFile) + '.' + selectedOption.getType());
|
String base = FileUtilities.getName(videoFile);
|
||||||
|
String subtitleName = String.format("%s.%s.%s", base, selectedOption.getLanguage(), selectedOption.getType());
|
||||||
|
|
||||||
|
return new File(videoFile.getParentFile(), subtitleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -599,7 +603,7 @@ class VideoHashSubtitleDownloadDialog extends JDialog {
|
|||||||
|
|
||||||
|
|
||||||
public String getText() {
|
public String getText() {
|
||||||
return subtitle.getName() + '.' + subtitle.getType();
|
return String.format("%s.%s.%s", subtitle.getName(), getLanguage(), getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -608,6 +612,12 @@ class VideoHashSubtitleDownloadDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
Language lang = Language.getLanguageByName(subtitle.getLanguageName());
|
||||||
|
return lang != null ? lang.getCode() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return subtitle.getType();
|
return subtitle.getType();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user