1
0
mirror of https://github.com/devfake/flox.git synced 2024-11-15 14:42:31 +01:00

Change tv tv_title to name (#24)

This commit is contained in:
Tim Meier 2017-01-06 15:30:38 +01:00 committed by Tim Meier
parent dbd6e99eee
commit bc9111075f
9 changed files with 29 additions and 43 deletions

View File

@ -13,7 +13,6 @@ module.exports = [
"tags" : "hd,1080p", "tags" : "hd,1080p",
"episode_number" : null, "episode_number" : null,
"season_number" : null, "season_number" : null,
"tv_title" : null,
"subtitles" : null "subtitles" : null
}, },
{ {
@ -30,7 +29,6 @@ module.exports = [
"tags" : "720p", "tags" : "720p",
"episode_number" : null, "episode_number" : null,
"season_number" : null, "season_number" : null,
"tv_title" : null,
"subtitles" : __dirname + "/movies/Warcraft.2016.720p.WEB-DL/Warcraft.2016.720p.WEB-DL.srt" "subtitles" : __dirname + "/movies/Warcraft.2016.720p.WEB-DL/Warcraft.2016.720p.WEB-DL.srt"
}, },
{ {
@ -47,7 +45,6 @@ module.exports = [
"tags" : "hd,1080p", "tags" : "hd,1080p",
"episode_number" : null, "episode_number" : null,
"season_number" : null, "season_number" : null,
"tv_title" : null,
"subtitles" : null "subtitles" : null
}, },
{ {
@ -64,7 +61,6 @@ module.exports = [
"tags" : "hd,1080p", "tags" : "hd,1080p",
"episode_number" : null, "episode_number" : null,
"season_number" : null, "season_number" : null,
"tv_title" : null,
"subtitles" : null "subtitles" : null
}, },
{ {
@ -81,7 +77,6 @@ module.exports = [
"tags" : "720p", "tags" : "720p",
"episode_number" : null, "episode_number" : null,
"season_number" : null, "season_number" : null,
"tv_title" : null,
"subtitles" : __dirname + "/movies/subfolder/Warcraft.2016.720p.WEB-DL/Warcraft.2016.720p.WEB-DL.srt" "subtitles" : __dirname + "/movies/subfolder/Warcraft.2016.720p.WEB-DL/Warcraft.2016.720p.WEB-DL.srt"
}, },
{ {
@ -98,7 +93,6 @@ module.exports = [
"tags" : "hd,1080p", "tags" : "hd,1080p",
"episode_number" : null, "episode_number" : null,
"season_number" : null, "season_number" : null,
"tv_title" : null,
"subtitles" : null "subtitles" : null
}, },
{ {
@ -115,7 +109,6 @@ module.exports = [
"tags" : "720p", "tags" : "720p",
"episode_number" : null, "episode_number" : null,
"season_number" : null, "season_number" : null,
"tv_title" : null,
"subtitles" : __dirname + "/movies/Warcraft.2016.720p.WEB-DL/Warcraft.2016.720p.WEB-DL.srt" "subtitles" : __dirname + "/movies/Warcraft.2016.720p.WEB-DL/Warcraft.2016.720p.WEB-DL.srt"
} }
] ]

View File

@ -1,7 +1,7 @@
var fetch = module.exports.fetch = { var fetch = module.exports.fetch = {
"tv": [ "tv": [
{ {
"tv_title": "Breaking Bad", "name": "Breaking Bad",
"season_number": 1, "season_number": 1,
"episode_number": 1, "episode_number": 1,
"extension": "mkv", "extension": "mkv",
@ -13,7 +13,7 @@ var fetch = module.exports.fetch = {
"src": __dirname + "/tv/Breaking Bad/S1/1.mkv" "src": __dirname + "/tv/Breaking Bad/S1/1.mkv"
}, },
{ {
"tv_title": "Breaking Bad", "name": "Breaking Bad",
"season_number": 1, "season_number": 1,
"episode_number": 2, "episode_number": 2,
"extension": "mkv", "extension": "mkv",
@ -25,7 +25,7 @@ var fetch = module.exports.fetch = {
"src": __dirname + "/tv/Breaking Bad/S1/2.mkv" "src": __dirname + "/tv/Breaking Bad/S1/2.mkv"
}, },
{ {
"tv_title": "Breaking Bad", "name": "Breaking Bad",
"season_number": 2, "season_number": 2,
"episode_number": 1, "episode_number": 1,
"status": "added", "status": "added",
@ -37,7 +37,7 @@ var fetch = module.exports.fetch = {
"src": __dirname + "/tv/Breaking Bad/s2/1.mp4" "src": __dirname + "/tv/Breaking Bad/s2/1.mp4"
}, },
{ {
"tv_title": "Breaking Bad", "name": "Breaking Bad",
"season_number": 2, "season_number": 2,
"episode_number": 2, "episode_number": 2,
"tags": [], "tags": [],
@ -49,7 +49,7 @@ var fetch = module.exports.fetch = {
"src": __dirname + "/tv/Breaking Bad/s2/2.mkv" "src": __dirname + "/tv/Breaking Bad/s2/2.mkv"
}, },
{ {
"tv_title": "Game of Thrones", "name": "Game of Thrones",
"season_number": 2, "season_number": 2,
"episode_number": 1, "episode_number": 1,
"status": "added", "status": "added",
@ -61,7 +61,7 @@ var fetch = module.exports.fetch = {
"src": __dirname + "/tv/Game of Thrones/S2/1.mkv" "src": __dirname + "/tv/Game of Thrones/S2/1.mkv"
}, },
{ {
"tv_title": "Game of Thrones", "name": "Game of Thrones",
"season_number": 2, "season_number": 2,
"episode_number": 2, "episode_number": 2,
"tags": [], "tags": [],
@ -73,7 +73,7 @@ var fetch = module.exports.fetch = {
"src": __dirname + "/tv/Game of Thrones/S2/2.mkv" "src": __dirname + "/tv/Game of Thrones/S2/2.mkv"
}, },
{ {
"tv_title": "Game of Thrones", "name": "Game of Thrones",
"season_number": 1, "season_number": 1,
"episode_number": 1, "episode_number": 1,
"extension": "mkv", "extension": "mkv",
@ -85,7 +85,7 @@ var fetch = module.exports.fetch = {
"src": __dirname + "/tv/Game of Thrones/s1/1.mkv" "src": __dirname + "/tv/Game of Thrones/s1/1.mkv"
}, },
{ {
"tv_title": "Game of Thrones", "name": "Game of Thrones",
"season_number": 1, "season_number": 1,
"tags": [], "tags": [],
"episode_number": 2, "episode_number": 2,

View File

@ -13,7 +13,6 @@ module.exports = [
"tags" : null, "tags" : null,
"episode_number" : 1, "episode_number" : 1,
"season_number" : 1, "season_number" : 1,
"tv_title" : "Breaking Bad",
"subtitles" : __dirname + "/tv/Breaking Bad/S1/1.srt" "subtitles" : __dirname + "/tv/Breaking Bad/S1/1.srt"
}, },
{ {
@ -30,7 +29,6 @@ module.exports = [
"tags" : null, "tags" : null,
"episode_number" : 2, "episode_number" : 2,
"season_number" : 1, "season_number" : 1,
"tv_title" : "Breaking Bad",
"subtitles" : __dirname + "/tv/Breaking Bad/S1/2.srt" "subtitles" : __dirname + "/tv/Breaking Bad/S1/2.srt"
}, },
{ {
@ -47,7 +45,6 @@ module.exports = [
"tags" : null, "tags" : null,
"episode_number" : 1, "episode_number" : 1,
"season_number" : 2, "season_number" : 2,
"tv_title" : "Breaking Bad",
"subtitles" : __dirname + "/tv/Breaking Bad/s2/1.srt" "subtitles" : __dirname + "/tv/Breaking Bad/s2/1.srt"
}, },
{ {
@ -64,7 +61,6 @@ module.exports = [
"tags" : null, "tags" : null,
"episode_number" : 2, "episode_number" : 2,
"season_number" : 2, "season_number" : 2,
"tv_title" : "Breaking Bad",
"subtitles" : __dirname + "/tv/Breaking Bad/s2/2.srt" "subtitles" : __dirname + "/tv/Breaking Bad/s2/2.srt"
}, },
{ {
@ -81,7 +77,6 @@ module.exports = [
"tags" : null, "tags" : null,
"episode_number" : 1, "episode_number" : 1,
"season_number" : 2, "season_number" : 2,
"tv_title" : "Game of Thrones",
"subtitles" : null "subtitles" : null
}, },
{ {
@ -98,7 +93,6 @@ module.exports = [
"tags" : null, "tags" : null,
"episode_number" : 2, "episode_number" : 2,
"season_number" : 2, "season_number" : 2,
"tv_title" : "Game of Thrones",
"subtitles" : null "subtitles" : null
}, },
{ {
@ -115,7 +109,6 @@ module.exports = [
"tags" : null, "tags" : null,
"episode_number" : 1, "episode_number" : 1,
"season_number" : 1, "season_number" : 1,
"tv_title" : "Game of Thrones",
"subtitles" : null "subtitles" : null
}, },
{ {
@ -132,7 +125,6 @@ module.exports = [
"tags" : null, "tags" : null,
"episode_number" : 2, "episode_number" : 2,
"season_number" : 1, "season_number" : 1,
"tv_title" : "Game of Thrones",
"subtitles" : null "subtitles" : null
}, },
{ {
@ -149,7 +141,6 @@ module.exports = [
"tags" : null, "tags" : null,
"episode_number" : 1, "episode_number" : 1,
"season_number" : 1, "season_number" : 1,
"tv_title" : "Breaking Bad",
"subtitles" : __dirname + "/tv/Breaking Bad/S1/1.srt" "subtitles" : __dirname + "/tv/Breaking Bad/S1/1.srt"
}, },
{ {
@ -166,7 +157,6 @@ module.exports = [
"tags" : null, "tags" : null,
"episode_number" : 1, "episode_number" : 1,
"season_number" : 1, "season_number" : 1,
"tv_title" : "Breaking Bad",
"subtitles" : __dirname + "/tv/Breaking Bad/S1/1.srt" "subtitles" : __dirname + "/tv/Breaking Bad/S1/1.srt"
}, },
{ {
@ -183,7 +173,6 @@ module.exports = [
"tags" : null, "tags" : null,
"episode_number" : 2, "episode_number" : 2,
"season_number" : 2, "season_number" : 2,
"tv_title" : "Breaking Bad",
"subtitles" : __dirname + "/tv/Breaking Bad/s2/2.srt" "subtitles" : __dirname + "/tv/Breaking Bad/s2/2.srt"
} }
] ]

View File

@ -471,7 +471,7 @@ describe("HTTP Server", () => {
"src": __dirname + "/fixtures/tv/Breaking Bad/S1/1.mp4", "src": __dirname + "/fixtures/tv/Breaking Bad/S1/1.mp4",
"status": "added", "status": "added",
"season_number": 1, "season_number": 1,
"tv_title": "Breaking Bad", "name": "Breaking Bad",
"year": null, "year": null,
"tags": [], "tags": [],
"filename": "1" "filename": "1"
@ -483,7 +483,7 @@ describe("HTTP Server", () => {
"src": __dirname + "/fixtures/tv/Breaking Bad/S1/1.mkv", "src": __dirname + "/fixtures/tv/Breaking Bad/S1/1.mkv",
"status": "removed", "status": "removed",
"season_number": 1, "season_number": 1,
"tv_title": "Breaking Bad", "name": "Breaking Bad",
"year": null, "year": null,
"tags": [], "tags": [],
"filename": "1" "filename": "1"
@ -495,7 +495,7 @@ describe("HTTP Server", () => {
"src": __dirname + "/fixtures/tv/Breaking Bad/S1/1.mkv", "src": __dirname + "/fixtures/tv/Breaking Bad/S1/1.mkv",
"status": "added", "status": "added",
"season_number": 1, "season_number": 1,
"tv_title": "Breaking Bad", "name": "Breaking Bad",
"year": null, "year": null,
"tags": [], "tags": [],
"filename": "1" "filename": "1"
@ -507,7 +507,7 @@ describe("HTTP Server", () => {
"src": __dirname + "/fixtures/tv/Breaking Bad/S1/1.mp4", "src": __dirname + "/fixtures/tv/Breaking Bad/S1/1.mp4",
"status": "removed", "status": "removed",
"season_number": 1, "season_number": 1,
"tv_title": "Breaking Bad", "name": "Breaking Bad",
"year": null, "year": null,
"tags": [], "tags": [],
"filename": "1" "filename": "1"
@ -519,7 +519,7 @@ describe("HTTP Server", () => {
"src": __dirname + "/fixtures/tv/Breaking Bad/s2/2.mkv", "src": __dirname + "/fixtures/tv/Breaking Bad/s2/2.mkv",
"status": "removed", "status": "removed",
"season_number": 2, "season_number": 2,
"tv_title": "Breaking Bad", "name": "Breaking Bad",
"year": null, "year": null,
"tags": [], "tags": [],
"filename": "2" "filename": "2"
@ -531,7 +531,7 @@ describe("HTTP Server", () => {
"src": __dirname + "/fixtures/tv/Breaking Bad/s2/2.mkv", "src": __dirname + "/fixtures/tv/Breaking Bad/s2/2.mkv",
"status": "added", "status": "added",
"season_number": 2, "season_number": 2,
"tv_title": "Breaking Bad", "name": "Breaking Bad",
"year": null, "year": null,
"tags": [], "tags": [],
"filename": "2" "filename": "2"

View File

@ -13,6 +13,7 @@ const append = (model, status) => {
src: model.src, src: model.src,
date: date, date: date,
status: status, status: status,
name: model.name,
year: model.year, year: model.year,
tags: model.tags ? model.tags.split(",") : [], tags: model.tags ? model.tags.split(",") : [],
filename: model.filename filename: model.filename
@ -21,16 +22,10 @@ const append = (model, status) => {
if(model.category === "tv") { if(model.category === "tv") {
Object.assign(base, { Object.assign(base, {
episode_number: model.episode_number, episode_number: model.episode_number,
season_number: model.season_number, season_number: model.season_number
tv_title: model.tv_title
}) })
} }
if(model.category === "movies") {
Object.assign(base, {
name: model.name
})
}
return base return base
} }

View File

@ -45,7 +45,6 @@ const addEpisode = (episodesPath, episodeName, promises, season_number, tv_title
name: tv_title, name: tv_title,
episode_number: helper.normalizeNumber(episodeName), episode_number: helper.normalizeNumber(episodeName),
season_number: season_number, season_number: season_number,
tv_title: tv_title,
src: absolutePathEpisode src: absolutePathEpisode
} }
})) }))

View File

@ -87,8 +87,8 @@ describe("Parser (tv)", () => {
result = parser.fetch() result = parser.fetch()
return result.tv.then((res) => { return result.tv.then((res) => {
got = res.filter((t) => t.tv_title === game_of_thrones) got = res.filter((t) => t.name === game_of_thrones)
bb = res.filter((t) => t.tv_title === breaking_bad) bb = res.filter((t) => t.name === breaking_bad)
got_s1 = got.filter((e) => e.season_number === 1) got_s1 = got.filter((e) => e.season_number === 1)
got_s2 = got.filter((e) => e.season_number === 2) got_s2 = got.filter((e) => e.season_number === 2)

View File

@ -0,0 +1,11 @@
'use strict';
module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.removeColumn("file_histories", "tv_title")
},
down: function (queryInterface, Sequelize) {
return queryInterface.addColumn("file_histories", "tv_title", Sequelize.STRING, { allowNull: true })
}
};

View File

@ -10,7 +10,6 @@ module.exports = function(sequelize, DataTypes) {
tags: DataTypes.TEXT, tags: DataTypes.TEXT,
episode_number: DataTypes.INTEGER, episode_number: DataTypes.INTEGER,
season_number: DataTypes.INTEGER, season_number: DataTypes.INTEGER,
tv_title: DataTypes.TEXT,
subtitles: DataTypes.TEXT, subtitles: DataTypes.TEXT,
createdAt: DataTypes.DATE, createdAt: DataTypes.DATE,
updatedAt: DataTypes.DATE, updatedAt: DataTypes.DATE,