JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #2621  
Old 23.05.2023, 15:38
neik neik is offline
Modem User
 
Join Date: May 2023
Posts: 3
Default

Quote:
Originally Posted by neik View Post
I'm trying to figure out a way of executing a bash-script at the end of either each extraction or at the end of the last extraction (not quite sure yet what would make more sense, probably after each extraction though).

Unfortunately, no coder here so I tried to find some available code here and also tried ChatGPT but don't get MyJDownloader to take the code.

Found the following code in this thread (**External links are only visible to Support Staff**...)...



...but unfortuantely MyJDownloader keeps telling me "Sorry, failed to set new values"

JD is running headless on Ubuntu 22.04.2 LTS.

Any hint is appreciated.
Nobody?
Reply With Quote
  #2622  
Old 25.05.2023, 23:04
de_canalslover de_canalslover is offline
I will play nice!
 
Join Date: May 2023
Posts: 1
Default mgpai's script does not work properly

Hi, as the title say mgpai's script seems not to work fully. I'm talking about
Save youtube links and basic information to a html page
Code:
// Save youtube links and basic information to a html page.
// Trigger required: "A Download Stopped"

// Get link property
String.prototype.prop = function() {
    return link.getProperty(this);
};

// Convert duration to hh:mm:ss.ms format
Date.prototype.duration = function() {
    var ms = parseInt((this % 1000) / 100);
    var ss = parseInt((this / 1000) % 60);
    var mm = parseInt((this / (1000 * 60)) % 60);
    var hh = parseInt((this / (1000 * 60 * 60)) % 24);

    hh = (hh < 10) ? "0" + hh : hh;
    mm = (mm < 10) ? "0" + mm : mm;
    ss = (ss < 10) ? "0" + ss : ss;

    return hh + ":" + mm + ":" + ss + "." + ms;
};

// Get media bitrate
Number.prototype.toKbps = function() {
    return ((this / mediaDuration) * 8).toFixed(2);
};

// youtube media check
var youtubeMedia = link.getHost() == "youtube.com" && (/\.(m4a|aac|ogg|mp3|mp4|webm)$/).test(link.getName());

// Get Data
if (youtubeMedia) {
    var output = [];
    var variant = JSON.parse("YT_VARIANT".prop());
    var variantData = JSON.parse(variant.data);
    var youtube = "<a href=\"" + "http"+ "s://youtube.com/";
    var saveFile = link.getDownloadPath() + ".info.html";
    var fileSize = link.getBytesTotal();
    var demux = (/DEMUX/).test(variant.id);
    var audioSize = !demux ? "DASH_AUDIO_SIZE".prop() : fileSize;
    var videoSize = "DASH_VIDEO_SIZE".prop();
    var mediaDuration = "YT_DURATION".prop();
    var data = {
        Video: youtube + "watch?v=" + "YT_ID".prop() + "\">" + "YT_TITLE".prop() + "</a>",
        Playlist: "YT_PLAYLIST_ID".prop() && "YT_PLAYLIST_TITLE".prop() ? youtube + "playlist?list=" + "YT_PLAYLIST_ID".prop() + "\">" + "YT_PLAYLIST_TITLE".prop() + "</a>" : null,
        User: youtube + "user/" + "YT_USER_NAME".prop() + "\">" + "YT_USER_NAME".prop() + "</a>",
        Channel: youtube + "channel/" + "YT_CHANNEL_ID".prop() + "\">" + "YT_CHANNEL".prop() + "</a>" + "\r\n",
        Published: new Date("YT_DATE".prop()).toDateString(),
        Size: (fileSize / 1048576).toFixed(2) + " MiB",
        Duration: new Date(mediaDuration).duration(),
        Width: variantData.width,
        Height: variantData.height,
        FPS: variantData.fps,
        Audio_Bitrate: audioSize.toKbps() + " kbps",
        Video_Bitrate: !demux && fileSize > audioSize ? videoSize.toKbps() + " kbps" : null,
        Overall_Bitrate: !demux && fileSize > audioSize ? fileSize.toKbps() + " kbps" : null,
        Variant_ID: variant.id,
    };
    // Generate output[]
    for (i in data) {
        if (data[i] && data[i] != -1) {
            output.push(i.replace(/_/g, " ") + " : " + data[i]);
        }
    }
    // Format output[] and save to html file
    try {
        deleteFile(saveFile, false); // Delete info file if it already exists on the disk.
        writeFile(saveFile, "<pre>" + output.join("<br>") + "</pre>", false);
    } catch (err) {
        log(err + "");
    }
}

When video stops downloading I get error: "TypeError: Cannot call method 'toKbps' of null (#43)" which results in script turning off in the Event Scripter which is irritating. I removed lines which had "toKbps" in them and there was no error but I would like to keep info regarding bitrate in html. I know that the script was written in 2016. I presume that there were some changes in youtube which make parts of this script to not work ideally. Any ideas how to fix the script?
Reply With Quote
  #2623  
Old 30.05.2023, 08:13
neik neik is offline
Modem User
 
Join Date: May 2023
Posts: 3
Default

Quote:
Originally Posted by neik View Post
I'm trying to figure out a way of executing a bash-script at the end of either each extraction or at the end of the last extraction (not quite sure yet what would make more sense, probably after each extraction though).

Unfortunately, no coder here so I tried to find some available code here and also tried ChatGPT but don't get MyJDownloader to take the code.

Found the following code in this thread (**External links are only visible to Support Staff**...)...



...but unfortuantely MyJDownloader keeps telling me "Sorry, failed to set new values"

JD is running headless on Ubuntu 22.04.2 LTS.

Any hint is appreciated.
For all those who might be interested on how I solved this:

I simply created a script checking for files in use and depending on the result it went ahead or stopped.

Put that script in a hourly running cronjob and that's it.
Reply With Quote
  #2624  
Old 30.05.2023, 16:06
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 66,538
Default

Merged EventScripter related threads.
__________________
JD Supporter, Plugin Dev. & Community Manager
JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #2625  
Old 30.05.2023, 21:36
GreenXIII GreenXIII is offline
Bandwidth Beast
 
Join Date: Mar 2013
Posts: 145
Default

Hello mgpai and friends,

I need a way to make JD2 notify me of URLs caught by Linkgrabber that are NOT supported. Currently, JD2 doesn't do anything with those links, and doesn't notify me that they are not supported.

If I add several links (via clipboard monitoring or a text file), the links that aren't supported by JD2's plugins should be listed somehow, so I can find another way to download them.

The best way would be a custom view on Linkgrabber ("Not supported", "Unavailable", "Error", anything that warns me that JD can't download them).

Is it doable?
Reply With Quote
  #2626  
Old 31.05.2023, 10:35
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 66,538
Default

@GreenXIII
I know this won't help you now but I wanted to point out that you are not the first user asking for such a feature to be added.
Related thread: Click
__________________
JD Supporter, Plugin Dev. & Community Manager
JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
That's true James
Quote:
Originally Posted by James
Die Leute verstehen einfach nicht dass nur weil man mit einer Waffe auch auf Menschen schießen kann dass ein Schützenver​ein kein Ort für Amoklaufide​en ist
Reply With Quote
  #2627  
Old 31.05.2023, 11:13
amcucchi amcucchi is offline
Junior Loader
 
Join Date: Oct 2020
Posts: 10
Question Rename filename single character

How I can write a script to rename all file I download that contains the character _ with character . ?

Example : I want to automatically rename this

I_Hate_Suzie_2021_1x01.mp4

in this

I.Hate.Suzie.2021.1x01.mp4

I tried to do a packagizer rule that for every file that contains * in the name

rename it in (I tried to write a regex formula similar to sed) /_/\./

but it not work.

Can you help me?
__________________
_____________
Amcucchi

Last edited by amcucchi; 31.05.2023 at 11:15.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 18:06.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.