from fabric.api import run, env
from fabric.context_managers import cd
import os

env.hosts = ['root@0.0.0.0:1337']


def update_podcasts():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        run('python3 manage.py updatepodcasts')


def setup_dev():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        run('python3 manage.py syncdb')
        run('python3 manage.py loaddata sample_podcasts')
        run('python3 manage.py updatepodcasts')
        run('python3 manage.py fetchepisodes')
        run('python3 manage.py update_index')


def rebuild_index():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        # Add --noinput flag because of this issue:
        # https://github.com/toastdriven/django-haystack/issues/902
        run('python3 manage.py rebuild_index --noinput')

from fabric.api import run, env
from fabric.context_managers import cd
import os

env.hosts = ['root@0.0.0.0:1337']


def update_podcasts():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        run('python3 manage.py updatepodcasts')


def fetch_episodes():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        run('python3 manage.py fetchepisodes')


def setup_dev():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        run('python3 manage.py syncdb')
        run('python3 manage.py loaddata sample_podcasts')
        run('python3 manage.py updatepodcasts')
        run('python3 manage.py fetchepisodes')
        run('python3 manage.py update_index')


def rebuild_index():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        # Add --noinput flag because of this issue:
        # https://github.com/toastdriven/django-haystack/issues/902
        run('python3 manage.py rebuild_index --noinput')

Add fab command for fetching episodes
Add fab command for fetching episodes

  from fabric.api import run, env
  from fabric.context_managers import cd
  import os
  
  env.hosts = ['root@0.0.0.0:1337']
  
  
  def update_podcasts():
      with cd('"{}"'.format(os.path.dirname(__file__))):
          run('python3 manage.py updatepodcasts')
+ 
+ 
+ def fetch_episodes():
+     with cd('"{}"'.format(os.path.dirname(__file__))):
+         run('python3 manage.py fetchepisodes')
  
  
  def setup_dev():
      with cd('"{}"'.format(os.path.dirname(__file__))):
          run('python3 manage.py syncdb')
          run('python3 manage.py loaddata sample_podcasts')
          run('python3 manage.py updatepodcasts')
          run('python3 manage.py fetchepisodes')
          run('python3 manage.py update_index')
  
  
  def rebuild_index():
      with cd('"{}"'.format(os.path.dirname(__file__))):
          # Add --noinput flag because of this issue:
          # https://github.com/toastdriven/django-haystack/issues/902
          run('python3 manage.py rebuild_index --noinput')
  
Add fab command for fetching episodes
## Code Before:
from fabric.api import run, env
from fabric.context_managers import cd
import os

env.hosts = ['root@0.0.0.0:1337']


def update_podcasts():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        run('python3 manage.py updatepodcasts')


def setup_dev():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        run('python3 manage.py syncdb')
        run('python3 manage.py loaddata sample_podcasts')
        run('python3 manage.py updatepodcasts')
        run('python3 manage.py fetchepisodes')
        run('python3 manage.py update_index')


def rebuild_index():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        # Add --noinput flag because of this issue:
        # https://github.com/toastdriven/django-haystack/issues/902
        run('python3 manage.py rebuild_index --noinput')

## Instruction:
Add fab command for fetching episodes
## Code After:
from fabric.api import run, env
from fabric.context_managers import cd
import os

env.hosts = ['root@0.0.0.0:1337']


def update_podcasts():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        run('python3 manage.py updatepodcasts')


def fetch_episodes():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        run('python3 manage.py fetchepisodes')


def setup_dev():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        run('python3 manage.py syncdb')
        run('python3 manage.py loaddata sample_podcasts')
        run('python3 manage.py updatepodcasts')
        run('python3 manage.py fetchepisodes')
        run('python3 manage.py update_index')


def rebuild_index():
    with cd('"{}"'.format(os.path.dirname(__file__))):
        # Add --noinput flag because of this issue:
        # https://github.com/toastdriven/django-haystack/issues/902
        run('python3 manage.py rebuild_index --noinput')
