JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #941  
Old 01.10.2019, 16:24
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 636
Default

Quote:
Originally Posted by Amiganer View Post
The best would be as it happend if the downloads remain in the Download-Screen. If the links comes in with the grabber and it is in the list, pop up the window: "delete allready downloaded files from list". If that is possible.
If you wish to review the duplicate links before deleting them, you can enable the "Sidebar" and use the built-in "Already in downloadlist" view filter rule to select them and use the context menu commands on that selection.
Reply With Quote
  #942  
Old 01.10.2019, 16:34
Demongornot Demongornot is offline
JD Beta
 
Join Date: Sep 2019
Location: Universe, Local group, Milky Way, Solar System, Earth, France
Posts: 50
Default

Quote:
Originally Posted by Jiaz View Post
I don't see any difference if I have to update the sticky thread and update to latest script version or update thread itself and either update first post or link updated script version in first post.
With the code I described, it will allow to basically self update the sticky while, in the script's thread, showing the script post's links before the first post.
Though the code in the first post won't fit well with the sticky index, and the sticky idex have more advantages as code in the first post don't allow for easily finding/seeing all scripts, better having the index linking directly to the latest post with the code.

Quote:
Originally Posted by Jiaz View Post
Who codes/maintains that *auto submitting/updating code* ?
Well, at least you need to make it once, then after there is almost nothing do to, if it is simple and light (and it don't need to be complex as it just append a text/link or change (update) the link url, it will be really light in term of maintenance, maybe some occasional check/change if the main forum's code change, when was the last change big enough to make such code require an update anyway ?
Reply With Quote
  #943  
Old 01.10.2019, 17:51
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

Quote:
Originally Posted by Demongornot View Post
Well, at least you need to make it once, then after there is almost nothing do to, if it is simple and light (and it don't need to be complex as it just append a text/link or change (update) the link url, it will be really light in term of maintenance, maybe some occasional check/change if the main forum's code change, when was the last change big enough to make such code require an update anyway ?
None of us is familiar enough for forum code and it's written in PHP and we're all Java guys So none of the team will be able to write it nor find time for it.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #944  
Old 01.10.2019, 22:16
Amiganer Amiganer is offline
DSL Light User
 
Join Date: Mar 2019
Posts: 30
Default Preventing double Downloads

Hello

Maybe let me think this way a little bit.....

Is there is an Event, if die Download is complete, I hope so...
Let the JD itself delete that link from the his normal Downloadlist (where it was downloaded from)...
Than add the downloaded link (coming from the event above) to a special Packagename, call "Already Downloaded" in the normal Downloadlist (putting the link back in the downloadList). If the links is again in the linkgrabber, it will be marked as double (because it is listed in the downloadList)....
Is this makeable?

If that works, JD can find double links the way it works now and the downloadList is cleaned up.
Maybe in a next step generate this with counter and generate a list every 100 links, maybe delete links from this list if older than 1year (configurable)...

Bye, Christian

Last edited by Amiganer; 01.10.2019 at 22:21. Reason: New Thoughts
Reply With Quote
  #945  
Old 01.10.2019, 22:16
Demongornot Demongornot is offline
JD Beta
 
Join Date: Sep 2019
Location: Universe, Local group, Milky Way, Solar System, Earth, France
Posts: 50
Default

Quote:
Originally Posted by Jiaz View Post
None of us is familiar enough for forum code and it's written in PHP and we're all Java guys So none of the team will be able to write it nor find time for it.
That's the opposite for me, I'm not a Java guy, though I know enough C and C++ to be familiar with the syntax and base of it, I did learn a bit of PHP a decade ago, PHP is a little different, but it is lite, it lies somewhere between Javascript and Java, the syntax is closer to Javascript than Java and while in Javascript you need to know a bit of Documents (DOM), for PHP this is more about knowing HTML and CSS, and you also need to be familiar with database like the old yet still popular MySQL for example.
So yeah even though you would still be familiar with the syntax and how it work, it would require a bit of conversion and as you said you haven't got the time, the first high level language I learned was VB.NET which have quite a different syntax, it make Javascript, Java, PHP, C and C++ look really similar in comparison, having also touched other kind of language/script/macro software that are different from each other, I find it easy to adapt to a new language, though I have yet to start with Haskell
But I also can guess how peoples who have seen languages with similar syntax only won't find it as easy to get to a new one.
In short, I understand well your position.
Reply With Quote
  #946  
Old 01.10.2019, 23:15
Amiganer Amiganer is offline
DSL Light User
 
Join Date: Mar 2019
Posts: 30
Default Programming Languages

Hello.

Where will I fit? A begun with BASIC V2 (C64), than Amiga, I can 68k Assembler, 6502 Assembler, Pascal (including Turbo Pascal), Fortran, Forth, Logo, Python, Java, C (example original K&R), C++, Modula II...

Maybe I have some forgotten...

Bye, Christian
Reply With Quote
  #947  
Old 02.10.2019, 02:06
Demongornot Demongornot is offline
JD Beta
 
Join Date: Sep 2019
Location: Universe, Local group, Milky Way, Solar System, Earth, France
Posts: 50
Default

Hello !
Well basically, you touched BASIC, Assembler and C like language which are 3 notable really different programming language syntax wise (I haven't learned the other yet so I can't speak for them), while the concept stay the same, C and BASIC are already different enough to give you a lot of adaptation capability when it come to learning others language regardless if they have a common syntax of one you already know or a syntax style you aren't familiar with.
But knowing Assembly is by far the best, as you, literally, know how the CPU itself work and you can guess what assembly code the compiler/interpreter translate the code of X language into, it give you the best adaptation ability since the pure logic of programming is already acquired, though it don't really prepare you for Object Oriented which is vastly different and other lesser popular which are different from Procedural Programming (and OOP)...

So learning Javascript will be really easy for you as the syntax is already something you are accustomed to and the difference to other languages (like how to declare variables for example) is basically still in the sphere of what you know, you will just need to learn HTML Documents which are objects, so it will be more a matter of finding and remembering them than learning them.

PHP too would be quite easy to learn for you as it too keep a lot of similarities with C like languages, and if you use it as its own language, you already have everything to just learn the difference and you are clear to go.
But for using it in websites it is different from other programming languages and you'll need to learn HTML (at least) and CSS, which are really simple and quick to learn, but it will probably be the most different language you touched from all the others you learned, it have interesting characteristics, such as allowing for syntax errors.
While your compilator will never allow you to write "if () [}" or" if () {" and not close it, in HTML where you have to write "<p>your text here</p>" to write text, something like "<p>your text here" (where you should normally write </p> to close) will still work, even plain text without that paragram code will work, it is basically an interpreted language and the browser is the interpreter, but each browser might interpret it slightly differently...
Watch the Youtube video "Where HTML beats C?" by Computerphile.

You can see the relation of HTML and CSS like the relation between a .c and a .h file, HTML tell your browser what to display and CSS tell it how to display it, and PHP is made so you literally write HTML code inside it (without using any kind of strings or functions, you could have a loop directly followed by HTML code as if it was another PHP line of code) to generate your pages, using PHP logic to make the page dynamically generated, using things like :
if (user_is_connected) { HTML code to show user avatar and account meny } else { HTML code to show the register and connect links }

PHP use databases like MySQL to get data, basically database are console command program and you simply use console commands from your code to search/write/delete datas.
And finally you have Javascript which like PHP allow to make dynamic pages, but allow to transform a page already loaded in the browser while PHP prepare it before sending it, a website where it refresh the page to show results are basically PHP where if it load new things without refreshing will basically be Javascript, though this is in theory, in reality there is a mix of both and Javascript can be used to make change as the page load, not just after, PHP is computer by servers while Javascript is computer by the client's browser and computer.
So because of the way they are all depending on each others and the unique syntax of XML/HTML and its relation with CSS which also have its own syntax, it make them totally different from anything else you ever saw, but the concept is still the same at the end and with what you know it will be really easy to learn all that, once you got all that, it is quite easy to work from here.

Short answer, you fit in a place where you can probably learn any new language without too much troubles, though some like Haskell and other Functional languages or other different paradigm or Brainf*ck which is a beast of its own are still different enough so you'll scratch your head at first until you get how they work, and HTML, CSS, PHP, database and Javascript are quite unique and require you to understand how they work alone and together, but it will still be easy to learn for you.
Though Quantum programming might be the HUGE exception, that's literally the Elephant in the room, as not only you don't work in binary anymore, and you have to know some heavy maths to really exploit it properly, but also the way Quantum physic work is totally unintuitive.
There are other exceptions, like ternary computer, Superscalar processor, VLIW, EPIC or even the DNA computing and other weird things that make the massively parallel computing of Super Computer actually "normal" and almost identical to regular computer in term of programming.
Reply With Quote
  #948  
Old 02.10.2019, 09:12
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 636
Default

Quote:
Originally Posted by Amiganer View Post
... if die Download is complete, I hope so...
Let the JD itself delete that link from the his normal Downloadlist (where it was downloaded from)...
Than add the downloaded link (coming from the event above) to a special Packagename, call "Already Downloaded" in the normal Downloadlist (putting the link back in the downloadList). If the links is again in the linkgrabber, it will be marked as double (because it is listed in the downloadList)....
Is this makeable?
It is possible to create a script to move the finished links to a different package, but you may need to disable "GeneralSettings.movefilesifdownloaddestinationchangesenabled" in advanced settings. Else, the files on disk will also be moved, if the source and destination package ("Already Downloaded") download folders are different.

Quote:
Originally Posted by Amiganer View Post
If that works, JD can find double links the way it works now and the downloadList is cleaned up.
Maybe in a next step generate this with counter and generate a list every 100 links, maybe delete links from this list if older than 1year (configurable)...
A better option would be to remove the links from the list by matching the finished date. Following script can be used to remove finished links which are older than 'x' days.

Caution: This script will remove links from the download list

Code:
// Remove finished links older than 'x' days
// Trigger : JDownloader Started

var days = 365; //<- Days to keep the finished links in list

var now = new Date();
var duration = days * 24 * 60 * 60 * 1000;

callAPI("downloadsV2", "queryLinks", {
    "finishedDate": true
}).filter(function(link) {
    return link.finishedDate;
}).forEach(function(link) {
    if (now - link.finishedDate > duration) getDownloadLinkByUUID(link.uuid).remove();
})
Reply With Quote
  #949  
Old 02.10.2019, 09:44
Amiganer Amiganer is offline
DSL Light User
 
Join Date: Mar 2019
Posts: 30
Default

Quote:
Originally Posted by mgpai View Post
It is possible to create a script to move the finished links to a different package, but you may need to disable "GeneralSettings.movefilesifdownloaddestinationchangesenabled" in advanced settings. Else, the files on disk will also be moved, if the source and destination package ("Already Downloaded") download folders are different.

......
Setting an option should be no problem.
(Please put it in comments of the script, so it is not forgotten.)

The only Thing: That will keep the growing downloadList, but seems to be the easy way.

Is there a documentation for the EventScript? Till now I have not found anything....

Maybe a little strange thing: Is it possible to quit JD and than rewrite the downloadList.zip?
How is the correct format of the downloadList?

Bye, Christian

Last edited by Amiganer; 02.10.2019 at 11:38. Reason: new idea
Reply With Quote
  #950  
Old 02.10.2019, 10:42
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 636
Default

Quote:
Originally Posted by Amiganer View Post
Setting an option should be no problem.
(Please put it in comments of the script, so it is not forgotten.)
Caution: This script will move finished links to a different package.

Code:
// Move finished link to user-defined package
// Trigger: A Download stopped
// IMPORTANT: Disable "GeneralSettings.movefilesifdownloaddestinationchangesenabled" in advanced settings

if (link.isFinished()) {
    var newPkgName = "Already Downloaded"; // <- Package name to which the finished link will be moved

    var linkIds = [link.getUUID()];
    var destPackageID = null;

    getAllFilePackages().some(function(package) {
        if (package.getName() == newPkgName) {
            destPackageID = package.getUUID();
            return true;
        }
    })

    if (destPackageID) {
        callAPI("downloadsV2", "moveLinks", linkIds, null, destPackageID);
    } else {
        callAPI("downloadsV2", "movetoNewPackage", linkIds, null, newPkgName, null);
    }
}

Quote:
Originally Posted by Amiganer View Post
Is there a documentation for the EventScript? Till now I have not found anything....
A list of available methods (with some examples) can be found in the eventscripter script editor (Main Menu > Show/Hide Help). You can also use MYJD API methods in the eventscripter (using callAPI method).

Code:
my.jdownloader.org/developers

If you need additional info/help, you can post your queries here. You can also find me/Jiaz in JD Chat.

Last edited by mgpai; 02.10.2019 at 11:18. Reason: Correction (Trigger: A Download stopped)
Reply With Quote
  #951  
Old 02.10.2019, 11:53
Amiganer Amiganer is offline
DSL Light User
 
Join Date: Mar 2019
Posts: 30
Default

Quote:
Originally Posted by mgpai View Post
Caution: This script will move finished links to a different package.
...
Than that's it, thank you.
So my Idea of recreate the downloadList.zip is obsolet, JD is doing it by himself.
What is keeped: The downloadList will be slowing down...

I think, that can be done by a plugin? It will collect (like the script now does) the finished links and if a new link arrives compare that with already downloaded linkList created by the plugin himself. If possible that will not more slowdown the downloadList by growing.

Is it possible to mark a downloadlink as double in the linkGrabber? As I know, highlithing it (red I think) is not possible, maybe something like a comment that is shown.... complex....

I'll try to figure that out with the new documentation you linked me....

Bye, Christian

P.S.: tried it and worked. Thanks. How can I put all already finished links to that script? Another trigger?
or running the script once over all links (how to do that)? Only a small issue: I can not give the Script a name?

Last edited by Amiganer; 02.10.2019 at 12:19. Reason: working script
Reply With Quote
  #952  
Old 02.10.2019, 12:50
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 636
Default

Quote:
Originally Posted by Amiganer View Post
How can I put all already finished links to that script? Another trigger?
Of course you can use a script, but it will be easier using GUI.

Assuming you have already disabled the 'advanced setting' and also have a "Already Downloaded" package.
  1. Use Quick filter in the bottom toolbar ("Successful Downloads") to view only the finished links.
  2. Select them and use the context menu command "Other > Move to a new Package" and move the links to a new package (For e.g. "Temp")
  3. Disable the quick filter. Merge "Temp" and "Already Downloaded" package, using drag 'n' drop.
Quote:
Originally Posted by Amiganer View Post
I can not give the Script a name?
In the eventscripter script list panel, double-click in the respective row in the 'name' column and type the desired name for the script.
Reply With Quote
  #953  
Old 03.10.2019, 11:50
Tom Tom is offline
Linkgrabbing Monster
 
Join Date: Jun 2018
Posts: 81
Default

@mgpai:
i have two feature request for my script.

-only convert audio stream with language ger

ffprobe example:
Stream #0:1(ger): Audio: dts
Stream #0:2(eng): Audio: dts
Stream #0:3(eng): Audio: ac3


-remove all other audio streams except ger one:
ffmpeg -i input -map 0 -map -0:a:2 -c copy output
Code:
-map 0 selects all streams from the input.
-map -0:a:2 then deselects audio stream 3. The stream index starts counting from 0, so audio stream 10 would be 0:a:9.


maybe this information helps you.

thx in advance!

Last edited by Tom; 03.10.2019 at 11:53.
Reply With Quote
  #954  
Old 03.10.2019, 13:23
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 636
Default

Quote:
Originally Posted by Amiganer View Post
I think, that can be done by a plugin? It will collect (like the script now does) the finished links...
Code:
// Build/update downloaded links history and add comment to finished link
// Trigger : JDownloader Started

var list = "c:/downloads/finished.txt"; // <- Set path to history file

var history = getPath(list).exists() ? readFile(getPath(list)).split("\r\n") : [];
var urls = [];

callAPI("downloadsV2", "queryLinks", {
    "comment": true,
    "finished": true
}).filter(function(apiLink) {
    return apiLink.finished && apiLink.comment != "Added to History";
}).forEach(function(apiLink) {
    var link = getDownloadLinkByUUID(apiLink.uuid);
    var url = link.getPluginURL();
    if (history.indexOf(url) == -1) {
        urls.push(url);
        link.setComment("Added to History");
    }
})

if (urls.length) writeFile(getPath(list), urls.join("\r\n") + "\r\n", true);

Quote:
Originally Posted by Amiganer View Post
... and if a new link arrives compare that with already downloaded linkList created by the plugin himself.
Code:
// Disable links, if they exist in history
// Trigger: A Download Started

var list = "c:/downloads/finished.txt"; // <- Location of history file
var history = getPath(list).exists() ? readFile(getPath(list)).split("\r\n") : [];

if (history.indexOf(link.getPluginURL()) > -1) link.setEnabled(false);

Quote:
Originally Posted by Amiganer View Post
Is it possible to mark a downloadlink as double in the linkGrabber? As I know, highlithing it (red I think) is not possible, maybe something like a comment that is shown.... complex....
Code:
// Move links to to "Already Downloaded" package, if they exist in history
// Trigger: Packgizer Hook
// IMPORTANT: Enable "Synchronous execution" checkbox

if (state == "AFTER") {
    var list = "c:/downloads/finished.txt"; // <- Location of downloaded links history file
    var history = getPath(list).exists() ? readFile(getPath(list)).split("\r\n") : [];

    if (history.indexOf(link.getURL()) > -1) link.setPackageName("Already Downloaded");
}
Reply With Quote
  #955  
Old 04.10.2019, 09:28
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 636
Default

Quote:
Originally Posted by Tom View Post
-only convert audio stream with language ger
-remove all other audio streams except ger one:
This is not my area of expertise. It will me as much time, as it would you to figure this out. It think if you specify only the audio stream language the output file will contain only that stream and you may not need to remove the others, because they will not be copied/converted at all.

This wiki has more information:
Code:
trac.ffmpeg.org/wiki/Map

I suggest you try converting the file in CLI. Once you find the correct command we can add it the script.
Reply With Quote
  #956  
Old 04.10.2019, 10:20
Tom Tom is offline
Linkgrabbing Monster
 
Join Date: Jun 2018
Posts: 81
Default

thx, great idea mgpai ;-)
this command works fine:

ffmpeg.exe -i path\file -map 0:0 -map 0:1 -c:v copy -c:s copy -c:a: ac3 -b:a 640k -c:s copy outputfile
Reply With Quote
  #957  
Old 04.10.2019, 10:37
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 636
Default

Quote:
Originally Posted by Tom View Post
thx, great idea mgpai ;-)
this command works fine:

ffmpeg.exe -i path\file -map 0:0 -map 0:1 -c:v copy -c:s copy -c:a: ac3 -b:a 640k -c:s copy outputfile
Replace the command in the script with then new command. Enclose the parameters in quotes separating them with ',' (comma) instead of 'space'.

Example:
Code:
callAsync(function(error) {
       if (!error) getPath(file).delete();
   }, ffmpeg, "-i", file, "-map", "0:0", "-map", "0:1", "-c:v", "copy", "-c:s", "copy", "-c:a:", "ac3", "-b:a", "640k", "-c:s", "copy", file.replace(ext, "_ac3." + ext));

Above command replaces the file extension with 'ac3', but look like the example provided by you only copies the stream and does not convert it. You may need to adjust the output file pattern accordingly.

Also, the audio stream map specified may not always be 'german', so you may also need to map the stream by language parameter, instead of stream ID.
Reply With Quote
  #958  
Old 04.10.2019, 12:48
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 636
Default

Quote:
Originally Posted by Demongornot View Post
... So I am out of idea about how to analyse only the latest links and already existing ones in a CPU and memory usage friendly way...
Can use this method to get new links added by a crawler job.

Code:
// Get links from finished crawljob
// Trigger: Remote API Event fired

if (event.publisher == "linkcrawler" && event.id == "FINISHED") {
    var jobId = JSON.parse(event.data).jobId;
    var isJobRunning = function() {
        return callAPI("linkgrabberv2", "queryLinkCrawlerJobs", {
            "collectorInfo": true,
            "jobIds": [jobId]
        }).some(function(job) {
            return job.crawling || job.checking;
        })
    }

    while (isJobRunning()) sleep(5000);

    callAPI("linkgrabberv2", "queryLinks", {
        "jobUUIDs": [jobId]
    }).forEach(function(apiLink) {
        var link = getCrawledLinkByUUID(apiLink.uuid);
        //alert(link.getUrl());
    })
}
Reply With Quote
  #959  
Old 04.10.2019, 13:46
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 636
Default

Quote:
Originally Posted by Tom View Post
ffmpeg.exe -i path\file -map 0:0 -map 0:1 -c:v copy -c:s copy -c:a: ac3 -b:a 640k -c:s copy outputfile
Quote:
Originally Posted by mgpai View Post
... look like the example provided by you only copies the stream and does not convert it.
Your example does indeed convert the audio stream. I saw the "copy" parameter at the end and thought it was for the audio stream. Turns out it was "-c:s copy", which appears twice in it. Does it need to be used twice?

In any case, you may still need to specify the language parameter to make sure your preferred choice of audio stream is converted.
Reply With Quote
  #960  
Old 04.10.2019, 14:18
Tom Tom is offline
Linkgrabbing Monster
 
Join Date: Jun 2018
Posts: 81
Default

you are right and twice is not needed.
i tested a bit and changed this as it worked in the CLI:
"-map", "0:0", "-map", "0:m:language:ger",

thx for the hint with the language selection :-)
lets see how it works in the next days...
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 07:32.
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 - 2019, Jelsoft Enterprises Ltd.