Skip to content

Commit

Permalink
Add date option for filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
phiphou committed Nov 19, 2016
1 parent 1b6b251 commit 1e36310
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ You can then use the list with `WGET` for instance :
$ wget -i vine_link_list.txt
```

#### Filenames

By default, Vines filenames are in the form `{POST_ID}.mp4`.

If you add a `--dates` flag, it will be `{YYYY-MM-DD_HH-MM-SS}_{POST_ID}.mp4`

## License

This project is licensed under the terms of the **[MIT license](https://opensource.org/licenses/MIT)**.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vine-backup",
"version": "1.3.1",
"version": "1.3.2",
"description": "A very basic tool for downloading your Vines before the service shut down.",
"author": {
"name": "Phiphou",
Expand Down
8 changes: 7 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,16 @@ function exportList () {
})
}

function make_filename(data){
let da = videos[0].data.created.split('T')
let time = ('' + da[1].split('.')[0]).replace(/:/g, '-');
return (argv.dates ? da[0] + '_' + time + '_' : '') + data.postId + '.mp4'
}

function dl () {
download(videos[0].data.videoUrl, {
directory: 'Vines/' + videos[0].type,
filename: videos[0].data.postId + '.mp4'
filename: make_filename(videos[0].data),
}, err => {
if (err) {
console.log(err, videos[0].data.postId)
Expand Down
22 changes: 10 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ cliui@^3.2.0:
wrap-ansi "^2.0.0"

code-point-at@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.0.1.tgz#1104cd34f9b5b45d3eba88f1babc1924e1ce35fb"
dependencies:
number-is-nan "^1.0.0"
version "1.1.0"
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"

colors@~0.6.1:
version "0.6.2"
Expand Down Expand Up @@ -116,8 +114,8 @@ get-caller-file@^1.0.1:
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5"

graceful-fs@^4.1.2:
version "4.1.9"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.9.tgz#baacba37d19d11f9d146d3578bc99958c3787e29"
version "4.1.10"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.10.tgz#f2d720c22092f743228775c75e3612632501f131"

hawk@~1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -406,15 +404,15 @@ y18n@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"

yargs-parser@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.0.2.tgz#7f7173a8c7cca1d81dc7c18692fc07c2c2e2b1e0"
yargs-parser@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.1.0.tgz#313df030f20124124aeae8fbab2da53ec28c56d7"
dependencies:
camelcase "^3.0.0"

yargs@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.3.0.tgz#19c6dbb768744d571eb6ebae0c174cf2f71b188d"
version "6.4.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.4.0.tgz#816e1a866d5598ccf34e5596ddce22d92da490d4"
dependencies:
camelcase "^3.0.0"
cliui "^3.2.0"
Expand All @@ -429,5 +427,5 @@ yargs@^6.3.0:
which-module "^1.0.0"
window-size "^0.2.0"
y18n "^3.2.1"
yargs-parser "^4.0.2"
yargs-parser "^4.1.0"

0 comments on commit 1e36310

Please sign in to comment.