private static final File FEEDURL_FILE = new File(APP_HOME, FEEDURL_NAME);
public static final String P_PATH_DB = "path.db";
public static final String P_PATH_SAVEFILE = "path.savefile";
+ public static final String P_SAVEFILE_PATTERN = "savefile.pattern";
public static final String P_FILE_ENCODING = "encoding";
public static final String P_NICOVIDEO_MAIL = "nicovideo.mail";
public static final String P_NICOVIDEO_PASSWORD = "nicovideo.password";
updatePropertyValue(p, P_PATH_DB);
updatePropertyValue(p, P_PATH_SAVEFILE);
+ updatePropertyValue(p, P_SAVEFILE_PATTERN);
updatePropertyValue(p, P_DOWNLOAD_RETRY);
updatePropertyValue(p, P_DOWNLOAD_WAIT);
savepath.append(saveDir.getAbsolutePath().replaceAll("\\\\", "\\\\\\\\"));
props.add(savepath);
+ props.add(P_SAVEFILE_PATTERN + "={title}");
+
props.add(P_FILE_ENCODING + "=" + System.getProperty("file.encoding"));
props.add(P_NICOVIDEO_MAIL + "=");
return properties.getString(P_PATH_SAVEFILE);
}
+ /**@return 保存ファイル名の命名規則. */
+ public String fileNamePattern() {
+ return properties.getString(P_SAVEFILE_PATTERN, "{title}");
+ }
+
/** @return feedurl.txtの文字エンコーディング. */
public String getEncoding() {
String res = properties.getString(P_FILE_ENCODING, System.getProperty("file.encoding"));
return FEEDURL_FILE;
}
- public static File getAppHome(){
+ public static File getAppHome() {
return APP_HOME;
}
}
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
- <SyntheticProperty name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-125,0,0,1,-107"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
- <Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
- <Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
- <Component id="jPanel4" alignment="0" max="32767" attributes="0"/>
- <Component id="jPanel3" alignment="0" max="32767" attributes="0"/>
- <Component id="jPanel5" alignment="0" max="32767" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jPanel5" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="1" attributes="0">
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
+ <Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
+ <Component id="jPanel4" alignment="0" max="32767" attributes="0"/>
+ <Component id="jPanel6" alignment="0" max="32767" attributes="0"/>
+ <Component id="jPanel3" alignment="1" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
+ <Component id="jPanel6" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel5" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
- <Component id="feedFileField" alignment="0" pref="301" max="32767" attributes="0"/>
- <Component id="configFileField" alignment="0" pref="301" max="32767" attributes="0"/>
+ <Component id="feedFileField" alignment="0" pref="376" max="32767" attributes="0"/>
+ <Component id="configFileField" alignment="0" pref="376" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
- <Component id="passField" pref="302" max="32767" attributes="0"/>
- <Component id="idField" alignment="0" pref="302" max="32767" attributes="0"/>
+ <Component id="passField" pref="377" max="32767" attributes="0"/>
+ <Component id="idField" alignment="0" pref="377" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
- <Component id="dbPathField" alignment="1" pref="281" max="32767" attributes="0"/>
- <Component id="flvPathField" alignment="1" pref="281" max="32767" attributes="0"/>
+ <Component id="dbPathField" alignment="1" pref="356" max="32767" attributes="0"/>
+ <Component id="flvPathField" alignment="1" pref="356" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="lowDownloadCheckBox" min="-2" max="-2" attributes="0"/>
- <EmptySpace pref="49" max="32767" attributes="0"/>
+ <EmptySpace pref="124" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
- <EmptySpace pref="332" max="32767" attributes="0"/>
+ <EmptySpace pref="407" max="32767" attributes="0"/>
<Component id="savaButton" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Component>
</SubComponents>
</Container>
+ <Container class="javax.swing.JPanel" name="jPanel6">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
+ <TitledBorder title="ファイル名規則"/>
+ </Border>
+ </Property>
+ </Properties>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="1" attributes="0">
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="jScrollPane1" alignment="0" pref="452" max="32767" attributes="0"/>
+ <Component id="jTextField1" alignment="1" pref="452" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jTextField1" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jScrollPane1" min="-2" pref="71" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JTextField" name="jTextField1">
+ </Component>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTextArea" name="jTextArea1">
+ <Properties>
+ <Property name="columns" type="int" value="20"/>
+ <Property name="editable" type="boolean" value="false"/>
+ <Property name="lineWrap" type="boolean" value="true"/>
+ <Property name="rows" type="int" value="5"/>
+ <Property name="text" type="java.lang.String" value="{title}: 動画タイトル
{id}: ニコニコ動画ID
{low}: エコノミー動画であれば"low"の文字列、通常動画は空文字列"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
</SubComponents>
</Form>
lowDownloadCheckBox = new javax.swing.JCheckBox();
jPanel5 = new javax.swing.JPanel();
savaButton = new javax.swing.JButton();
+ jPanel6 = new javax.swing.JPanel();
+ jTextField1 = new javax.swing.JTextField();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ jTextArea1 = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("NicoBrowser - コンフィグ設定");
.add(feedFileLabel))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(feedFileField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE)
- .add(configFileField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 301, Short.MAX_VALUE)))
+ .add(feedFileField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
+ .add(configFileField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)))
.add(jPanel1Layout.createSequentialGroup()
.add(jLabel5)
.addContainerGap())
.add(passLabel))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(passField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 302, Short.MAX_VALUE)
- .add(idField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 302, Short.MAX_VALUE)))
+ .add(passField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 377, Short.MAX_VALUE)
+ .add(idField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 377, Short.MAX_VALUE)))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel3))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(org.jdesktop.layout.GroupLayout.TRAILING, dbPathField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE)
- .add(org.jdesktop.layout.GroupLayout.TRAILING, flvPathField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE))
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, dbPathField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 356, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, flvPathField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 356, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, flvPathButton)
.add(retrySpinner)))
.add(18, 18, 18)
.add(lowDownloadCheckBox)
- .addContainerGap(49, Short.MAX_VALUE))
+ .addContainerGap(124, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel5Layout.createSequentialGroup()
- .addContainerGap(332, Short.MAX_VALUE)
+ .addContainerGap(407, Short.MAX_VALUE)
.add(savaButton))
);
jPanel5Layout.setVerticalGroup(
.add(savaButton)
);
+ jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("ファイル名規則"));
+
+ jTextArea1.setColumns(20);
+ jTextArea1.setEditable(false);
+ jTextArea1.setLineWrap(true);
+ jTextArea1.setRows(5);
+ jTextArea1.setText("{title}: 動画タイトル\n{id}: ニコニコ動画ID\n{low}: エコノミー動画であれば\"low\"の文字列、通常動画は空文字列");
+ jScrollPane1.setViewportView(jTextArea1);
+
+ org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6);
+ jPanel6.setLayout(jPanel6Layout);
+ jPanel6Layout.setHorizontalGroup(
+ jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel6Layout.createSequentialGroup()
+ .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
+ .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE)
+ .add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ jPanel6Layout.setVerticalGroup(
+ jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jPanel6Layout.createSequentialGroup()
+ .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 71, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ );
+
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
- .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(layout.createSequentialGroup()
+ .add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addContainerGap())
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
+ .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jPanel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
+ private javax.swing.JPanel jPanel6;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTextArea jTextArea1;
+ private javax.swing.JTextField jTextField1;
private javax.swing.JCheckBox lowDownloadCheckBox;
private javax.swing.JPasswordField passField;
private javax.swing.JLabel passLabel;
import nicobrowser.Config;
import nicobrowser.GetFlvResult;
import nicobrowser.Config.NicoFeed;
+import nicobrowser.NamePattern;
import nicobrowser.NicoHttpClient;
import nicobrowser.ProgressListener;
import nicobrowser.VideoInfo;
}
}
prevDate = Calendar.getInstance().getTime();
- File saveLocation = new File(config.getSrcSaveDir(), c.getFileName());
+ File saveDir = new File(config.getSrcSaveDir());
+ NamePattern np = new NamePattern(config.fileNamePattern(), c.getFileName());
log.info("ファイルを取得します: " + c.getNicoId() + " " + c.getTitle());
try {
VideoInfo vi = instance.getVideoInfo(c.getNicoId());
- GetFlvResult result = instance.getFlvFile(vi,
- saveLocation.getCanonicalPath(), c.getStatus(), config.needLowFile(),
+ GetFlvResult result = instance.getFlvFile(vi, saveDir, np, c.getStatus(), config.needLowFile(),
ProgressListener.EMPTY_LISTENER);
c.setAuthor(result.getAuthor());
Status status = result.getStatus();