GithubHelp home page GithubHelp logo

Comments (3)

garfield69 avatar garfield69 commented on June 9, 2024 1

Should do. I'm not manipulating the daynumber directly, but added a moment.js call to the existing moment chain, to either subtract or add days to the broadcast date.

if (serie.TRAKT_ID in episodesWithDateFormat) {
if (typeof (moment) === 'undefined') {
moment = require('./js/vendor/moment.quacked.js')
}
// check for custom DD modifier, examples DD[-1] , DD[+5] , etc, which subtracts or adds to the number of days
if (episodesWithDateFormat[serie.TRAKT_ID].indexOf("DD[") > -1) {
// extract the modifier
var startDD = episodesWithDateFormat[serie.TRAKT_ID].indexOf("[")
var endDD = episodesWithDateFormat[serie.TRAKT_ID].indexOf("]") + 1
var modifierDD = episodesWithDateFormat[serie.TRAKT_ID].slice(startDD, endDD)
var dateFormat = episodesWithDateFormat[serie.TRAKT_ID].replace(modifierDD, "")
if (modifierDD.indexOf("-") > -1) {
// subtract days
var modifierNumber = modifierDD.replace("[-", "").replace("]", "")
return $q.resolve(sceneName + moment.tz(episode.firstaired_iso, serie.timezone).subtract(modifierNumber, 'd').format(dateFormat) + append)
} else {
// add days
var modifierNumber = modifierDD.replace("[+", "").replace("]", "")
return $q.resolve(sceneName + moment.tz(episode.firstaired_iso, serie.timezone).add(modifierNumber, 'd').format(dateFormat) + append)
}
} else {
return $q.resolve(sceneName + moment.tz(episode.firstaired_iso, serie.timezone).format(episodesWithDateFormat[serie.TRAKT_ID]) + append)
}
} else {
return SceneXemResolver.getEpisodeMapping(serie, episode, sceneName, append)
}
},

from duckietv.

garfield69 avatar garfield69 commented on June 9, 2024

https://github.com/DuckieTV/Nightlies/releases/tag/nightly-202401201038

from duckietv.

ilike2burnthing avatar ilike2burnthing commented on June 9, 2024

Ta, working.

I realise I'm a bit late thinking of this now, but is this able to account for crossing months, e.g. -1 on the 1st Feb would be the 31st Jan and not the 0th Feb, and +1 on the 31st Jan would be the 1st Feb and not the 32nd Jan?

from duckietv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.