import os
from urllib.parse import urlencode, quote

from autobit import Client


def add_rarbg_feed(client, name, directory, filter_kwargs):
    url = 'http://localhost:5555/{}?{}'.format(
        quote(name),
        urlencode(filter_kwargs)
    )

    return client.add_feed(name, url, directory)


def main():
    client = Client('http://localhost:8081/gui/', auth=('admin', '20133'))

    name = input('name> ')
    directory = input('directory> ')

    os.makedirs(directory, exist_ok=True)

    if input('rarbg[yn]> ') == 'n':
        client.add_feed(
            name,
            input('url> '),
            directory
        )
    else:
        add_rarbg_feed(
            client,
            name,
            directory,
            eval(input('filter dict> '))
        )


if __name__ == '__main__':
    main()

import os

from autobit import Client


def main():
    client = Client('http://localhost:8081/gui/', auth=('admin', '20133'))
    client.get_torrents()

    name = input('name> ')
    directory = input('directory> ')

    os.makedirs(directory, exist_ok=True)

    client.add_feed(
        name,
        input('url> '),
        directory
    )


if __name__ == '__main__':
    main()

Remove code specific to my system
Remove code specific to my system

  import os
- from urllib.parse import urlencode, quote
  
  from autobit import Client
  
  
- def add_rarbg_feed(client, name, directory, filter_kwargs):
-     url = 'http://localhost:5555/{}?{}'.format(
-         quote(name),
-         urlencode(filter_kwargs)
-     )
- 
-     return client.add_feed(name, url, directory)
- 
- 
  def main():
      client = Client('http://localhost:8081/gui/', auth=('admin', '20133'))
+     client.get_torrents()
  
      name = input('name> ')
      directory = input('directory> ')
  
      os.makedirs(directory, exist_ok=True)
  
-     if input('rarbg[yn]> ') == 'n':
-         client.add_feed(
+     client.add_feed(
-             name,
+         name,
-             input('url> '),
+         input('url> '),
-             directory
+         directory
+     )
-         )
-     else:
-         add_rarbg_feed(
-             client,
-             name,
-             directory,
-             eval(input('filter dict> '))
-         )
  
  
  if __name__ == '__main__':
      main()
  
Remove code specific to my system
## Code Before:
import os
from urllib.parse import urlencode, quote

from autobit import Client


def add_rarbg_feed(client, name, directory, filter_kwargs):
    url = 'http://localhost:5555/{}?{}'.format(
        quote(name),
        urlencode(filter_kwargs)
    )

    return client.add_feed(name, url, directory)


def main():
    client = Client('http://localhost:8081/gui/', auth=('admin', '20133'))

    name = input('name> ')
    directory = input('directory> ')

    os.makedirs(directory, exist_ok=True)

    if input('rarbg[yn]> ') == 'n':
        client.add_feed(
            name,
            input('url> '),
            directory
        )
    else:
        add_rarbg_feed(
            client,
            name,
            directory,
            eval(input('filter dict> '))
        )


if __name__ == '__main__':
    main()

## Instruction:
Remove code specific to my system
## Code After:
import os

from autobit import Client


def main():
    client = Client('http://localhost:8081/gui/', auth=('admin', '20133'))
    client.get_torrents()

    name = input('name> ')
    directory = input('directory> ')

    os.makedirs(directory, exist_ok=True)

    client.add_feed(
        name,
        input('url> '),
        directory
    )


if __name__ == '__main__':
    main()
