Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This does not search for item dependencies? #3

Closed
DimaSheiko opened this issue Mar 13, 2022 · 6 comments
Closed

This does not search for item dependencies? #3

DimaSheiko opened this issue Mar 13, 2022 · 6 comments

Comments

@DimaSheiko
Copy link

Hi, I would like to know if this script looks for the dependencies of what I am downloading and also downloads them, that is, if I want to download a collection then it would be ideal to download all the items in the collection and also the dependencies of each item.

@ErenKrt
Copy link
Owner

ErenKrt commented Mar 13, 2022

Hi, thanks for your feedback. If you tried to download with the global command, unfortunately it did not give you what you wanted. The global command simply downloads according to the given IDs. I wanted to keep the global command simple. Beacuse I will be change the structure in the future.

I'm sharing code with you for download all workshop items and all dependencies of items.
Code collect all workshop items and dependencies id after that push all ids to download.

var {Downloader}= require('steamworkshopdownloader');
var MyDown= new Downloader();

async function GetAllIDS(Workshop){
    var WorkShopIDs = [];

    if(Workshop.fileType!=2){
        WorkShopIDs.push(Workshop.id);
    }

    if(Workshop.childs!=null && Workshop.childs.length > 0){
        for(const SingleChild of Workshop.childs){
            var ChildInfo= await MyDown.Info([SingleChild.id]);
            var ChildsOfChild=await GetAllIDS(ChildInfo.data[0]);
            for(const SingleChildOfChilds of ChildsOfChild){
                WorkShopIDs.push(SingleChildOfChilds);
            }
        }
    }

   return WorkShopIDs;
}

(async function(){
    var Down= await MyDown.Info([2276588418]); // your collection id or workshop item

    if(Down.data==null || Down.data.length <= 0){
        console.log("Cant find workshop infos !!!");
    }
    var AllIDS=[];

    for(const SingleWorkShop of Down.data){
        AllIDS= AllIDS.concat(await GetAllIDS(SingleWorkShop));
    }

    var Uniqs= AllIDS.filter((item, i, ar) => ar.indexOf(item) === i);

    await MyDown.Download(Uniqs,"./downs/");
})()

@ErenKrt
Copy link
Owner

ErenKrt commented Mar 23, 2022

Hello again, this feature added on version of 3. You can use "-d" option in your command.

@ErenKrt ErenKrt closed this as completed Mar 23, 2022
@DimaSheiko
Copy link
Author

DimaSheiko commented Mar 27, 2022

This is awesome!!! Thank you!

The first download I tried did not work for me. I tried with other items from the workshop and it worked fine.
steamwd 2782791830 -d dont work for me
1552611740 also does not work
1265936057 This one seems to work partially, it downloads some items and not others, my console is going crazy with this collection. Tried a second time and got the error TypeError: Cannot read property 'IDS' of undefined

@ErenKrt
Copy link
Owner

ErenKrt commented Mar 27, 2022

The api I use does not return some things as I want. That's why such errors can occur. Thank you for creating an issue. I will solve it as soon as possible.

@ErenKrt ErenKrt reopened this Mar 27, 2022
@ErenKrt
Copy link
Owner

ErenKrt commented Mar 27, 2022

Hello again, dont forget update this package for 3.1.0
I made the update by examining the ids one by one.

2782791830 / 1552611740 = Make infinity dependencies request
1265936057 = Have so many items, console cant show at same time

@DimaSheiko
Copy link
Author

This is absolutely great! Thank you so much for this! It now works great with the tests I have done. You rocked it.
Thank you so much again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants