mirror of
				https://github.com/karl0ss/JDRssDownloader.git
				synced 2025-11-04 08:31:00 +00:00 
			
		
		
		
	edit show quality + last downloaded file
This commit is contained in:
		
							parent
							
								
									0cc32b18c9
								
							
						
					
					
						commit
						df44638771
					
				@ -55,6 +55,7 @@ async function filterFeed() {
 | 
			
		||||
                            log.tele(downloadList.length + ' links for ' + urlObj.fileName + ' have been sent to JDdownloader.')
 | 
			
		||||
                            linkAdder(downloadList)
 | 
			
		||||
                            global.linkCheckTime = new Date();
 | 
			
		||||
                            global.lastDownloadedLink = urlObj.fileName
 | 
			
		||||
                        }
 | 
			
		||||
                    } else {
 | 
			
		||||
                        // No HEVC links found
 | 
			
		||||
 | 
			
		||||
@ -25,6 +25,7 @@ app.use(basicAuth({
 | 
			
		||||
global.rssRefreshTime = new Date();
 | 
			
		||||
global.linkCheckTime = new Date();
 | 
			
		||||
global.version = require('./package.json').version;
 | 
			
		||||
global.lastDownloadedLink = 'None'
 | 
			
		||||
 | 
			
		||||
global.log = require('simple-node-logger').createSimpleLogger({
 | 
			
		||||
    logFilePath: 'jdrssdownloader.log',
 | 
			
		||||
 | 
			
		||||
@ -41,7 +41,27 @@ async function removeShow(showData) {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
    addNewShow, removeShow
 | 
			
		||||
 | 
			
		||||
async function editShow(showData) {
 | 
			
		||||
    let shows = JSON.parse(fs.readFileSync('shows.json'))
 | 
			
		||||
    for (let index = 0; index < shows.length; index++) {
 | 
			
		||||
        const element = shows[index];
 | 
			
		||||
        if (element.Name == showData.showName) {
 | 
			
		||||
            shows[index] = {
 | 
			
		||||
                "Name": showData.showName,
 | 
			
		||||
                "Quality": showData.quality
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    try {
 | 
			
		||||
        fs.writeFileSync('shows.json', JSON.stringify(shows));
 | 
			
		||||
        log.info(showData.showName + ' Quality modified to ' + showData.quality + 'p')
 | 
			
		||||
    } catch (err) {
 | 
			
		||||
        console.error(err);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
    addNewShow, removeShow, editShow
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -7,6 +7,6 @@ module.exports = function (app) {
 | 
			
		||||
        showListLength = JSON.parse(fs.readFileSync('shows.json')).length
 | 
			
		||||
        rssTime = nextRssRefresh()
 | 
			
		||||
        linkCheck = nextLinkCheck()
 | 
			
		||||
        res.render("index", { title: "Home", showListLength: showListLength, version: global.version, rssTime: rssTime, linkCheck: linkCheck });
 | 
			
		||||
        res.render("index", { title: "Home", showListLength: showListLength, version: global.version, rssTime: rssTime, linkCheck: linkCheck, lastDownloaded: global.lastDownloadedLink });
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
const fs = require("fs");
 | 
			
		||||
const { addNewShow, removeShow } = require('.././apiFunctions')
 | 
			
		||||
const { addNewShow, removeShow, editShow } = require('.././apiFunctions')
 | 
			
		||||
 | 
			
		||||
module.exports = function (app) {
 | 
			
		||||
    app.get("/shows", (req, res) => {
 | 
			
		||||
@ -16,6 +16,11 @@ module.exports = function (app) {
 | 
			
		||||
        res.render("removeshow", { title: "Remove Show", showList: showList });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    app.get("/shows/edit", (req, res) => {
 | 
			
		||||
        showList = JSON.parse(fs.readFileSync('shows.json'))
 | 
			
		||||
        res.render("editShow", { title: "Edit Show", showList: showList });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    app.post('/addNewShow', (req, res) => {
 | 
			
		||||
        addNewShow(req.body)
 | 
			
		||||
        res.redirect("/shows");
 | 
			
		||||
@ -25,4 +30,9 @@ module.exports = function (app) {
 | 
			
		||||
        removeShow(req.body)
 | 
			
		||||
        res.redirect("/shows");
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    app.post('/editShow', (req, res) => {
 | 
			
		||||
        editShow(req.body)
 | 
			
		||||
        res.redirect("/shows");
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										20
									
								
								views/editShow.pug
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								views/editShow.pug
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
			
		||||
extends layout
 | 
			
		||||
 | 
			
		||||
block layout-content
 | 
			
		||||
  div.View
 | 
			
		||||
    h1.Banner Edit Show
 | 
			
		||||
    div.Message
 | 
			
		||||
      form(action="/editShow" method="POST")
 | 
			
		||||
        p Show Name: 
 | 
			
		||||
          select(name="showName")
 | 
			
		||||
            each show in showList
 | 
			
		||||
                option(value=show.Name) #{show.Name}
 | 
			
		||||
        p Quality: 
 | 
			
		||||
          select(name="quality")
 | 
			
		||||
            option(value='720') #{'720p'}
 | 
			
		||||
            option(value='1080') #{'1080p'}
 | 
			
		||||
            option(value='2160') #{'2160p'}
 | 
			
		||||
        input(type="submit", value="Edit Show")
 | 
			
		||||
    div.NavButtons
 | 
			
		||||
      a(href="/")
 | 
			
		||||
          div.NavButton Home
 | 
			
		||||
@ -7,6 +7,8 @@ block layout-content
 | 
			
		||||
      div.Message
 | 
			
		||||
        h3 Number of Tracked Shows
 | 
			
		||||
        h1 #{showListLength}
 | 
			
		||||
        h3 Last Downloaded
 | 
			
		||||
        h1 #{lastDownloaded}            
 | 
			
		||||
        h3 Next RSS Refresh
 | 
			
		||||
        h1 #{rssTime}
 | 
			
		||||
        h3 Next Link Check
 | 
			
		||||
@ -16,6 +18,8 @@ block layout-content
 | 
			
		||||
          div.NavButton Show List
 | 
			
		||||
      a(href="/shows/add")
 | 
			
		||||
          div.NavButton Add New Show
 | 
			
		||||
      a(href="/shows/edit")
 | 
			
		||||
          div.NavButton Edit Show          
 | 
			
		||||
      a(href="/shows/remove")
 | 
			
		||||
          div.NavButton Remove Show
 | 
			
		||||
      a(href="/logFile")
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user