jannislehmann / csgo-tools

A toolset for csgo, which automatically downloads new demos and features a demo parser for (currently basic) performance metrics on match and player basis.
10 stars 1 forks source link

Prevent duplicate demo downloading #37

Closed jannislehmann closed 3 years ago

jannislehmann commented 3 years ago

The match id we use to scan the demo file names and the match ids, which the GC return, are not the same. Therefore, demos could be downloaded twice in the following scenario:

  1. Full database reset, which scans the demo dir. This creates database entries for the local demos with some kind of match id.
  2. Run the API client to get the latest matches, which will return share codes
  3. Decode the share codes, which will return a similar match id.
  4. Get the download link via the GC.

The file name in the download link matches the match id from already downloaded demos. However this is different to the decoded match id.

A possible way could be to check the file names of the to be downloaded demo and query the db for this specific id. If that exists, skip the download.

However, the best way would be to somehow merge the entries.

jannislehmann commented 3 years ago

I just checked the decoded share codes. And the outcomeid seems to be the real matchid. I think we need to switch these two.

jannislehmann commented 3 years ago

I reverted the changes and fixed it in this commit https://github.com/Cludch/csgo-tools/pull/18/files#diff-9e1e6b7d9dbd342dee1b2da2563583ea10a1021388a30d5563b75bef0b4814ccR25