anacrolix / anacrolix/confluence

Proposal: Match torrent file by Regexp

Ouverte
#41 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Go
Étoiles
264
Forks
34
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

The only way to select a specific file is by its path, example:

```sh
vlc 'http://localhost:8080/data?magnet=...&path=Sintel.mp4'
```

Using regexp it can happen like that:
```sh
vlc 'http://localhost:8080/data?magnet=...&match=\.mp4$'
```

In that way, the client can create a regexp that defines its interest and simplify your flow without needing to:
1. Fetch the metainfo first.
2. Unmarshall the response.
3. Match the right file path.

This can be useful for the context of video media which usually only one video file is shared per magnet. Sample of a generic regexp that match the most popular video formats: `\.(avi|mp4|mkv|webm)$`.

Caveat:
Following the example, maybe a magnet points to many 'mp4's files, in that case, to maintain an easy algorithm correctness I suggest to return the first match.

---

Wildcard alternative:

Despite my last example, regex syntax can be really creepy, I prefer the unix shell wildcard notation that is:
```sh
vlc 'http://localhost:8080/data?magnet=...&match=*.{mp4,mkv}'
```

But I don't think that Golang provides a built-in support to this.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.