renamed project

This commit is contained in:
danilo silva 2020-06-08 21:37:11 +00:00
parent 579cc97bab
commit f7a5054de7
44 changed files with 155 additions and 155 deletions

View file

@ -55,4 +55,4 @@ RUN chown -R app: ./prod
USER app USER app
# Run the Phoenix app # Run the Phoenix app
CMD ["./prod/rel/podcast_feed/bin/podcast_feed", "start"] CMD ["./prod/rel/openpod/bin/openpod", "start"]

View file

@ -7,18 +7,18 @@
# General application configuration # General application configuration
use Mix.Config use Mix.Config
config :podcast_feed, config :openpod,
ecto_repos: [PodcastFeed.Repo] ecto_repos: [Openpod.Repo]
# Configures the endpoint # Configures the endpoint
config :podcast_feed, PodcastFeedWeb.Endpoint, config :openpod, OpenpodWeb.Endpoint,
url: [host: "localhost"], url: [host: "localhost"],
secret_key_base: "SWl0xVj8AVXoc2G0eUk6VfeOd/lppjkaKbiHWs4ucxAUJ8+wzAEa4bMo0ZVjtVVk", secret_key_base: "SWl0xVj8AVXoc2G0eUk6VfeOd/lppjkaKbiHWs4ucxAUJ8+wzAEa4bMo0ZVjtVVk",
render_errors: [view: PodcastFeedWeb.ErrorView, accepts: ~w(html json), layout: false], render_errors: [view: OpenpodWeb.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: PodcastFeed.PubSub, pubsub_server: Openpod.PubSub,
live_view: [signing_salt: "6jHv46Xw"] live_view: [signing_salt: "6jHv46Xw"]
config :podcast_feed, config :openpod,
cache_duration: :timer.hours(24) cache_duration: :timer.hours(24)
# Configures Elixir's Logger # Configures Elixir's Logger

View file

@ -1,10 +1,10 @@
use Mix.Config use Mix.Config
# Configure your database # Configure your database
config :podcast_feed, PodcastFeed.Repo, config :openpod, Openpod.Repo,
username: "postgres", username: "postgres",
password: "postgres", password: "postgres",
database: "podcast_feed_dev", database: "openpod_dev",
hostname: "localhost", hostname: "localhost",
show_sensitive_data_on_connection_error: true, show_sensitive_data_on_connection_error: true,
pool_size: 10 pool_size: 10
@ -15,7 +15,7 @@ config :podcast_feed, PodcastFeed.Repo,
# The watchers configuration can be used to run external # The watchers configuration can be used to run external
# watchers to your application. For example, we use it # watchers to your application. For example, we use it
# with webpack to recompile .js and .css sources. # with webpack to recompile .js and .css sources.
config :podcast_feed, PodcastFeedWeb.Endpoint, config :openpod, OpenpodWeb.Endpoint,
http: [port: 5000], http: [port: 5000],
debug_errors: true, debug_errors: true,
code_reloader: true, code_reloader: true,
@ -55,13 +55,13 @@ config :podcast_feed, PodcastFeedWeb.Endpoint,
# different ports. # different ports.
# Watch static and templates for browser reloading. # Watch static and templates for browser reloading.
config :podcast_feed, PodcastFeedWeb.Endpoint, config :openpod, OpenpodWeb.Endpoint,
live_reload: [ live_reload: [
patterns: [ patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$", ~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$", ~r"priv/gettext/.*(po)$",
~r"lib/podcast_feed_web/(live|views)/.*(ex)$", ~r"lib/openpod_web/(live|views)/.*(ex)$",
~r"lib/podcast_feed_web/templates/.*(eex)$" ~r"lib/openpod_web/templates/.*(eex)$"
] ]
] ]

View file

@ -9,7 +9,7 @@ use Mix.Config
# manifest is generated by the `mix phx.digest` task, # manifest is generated by the `mix phx.digest` task,
# which you should run after static files are built and # which you should run after static files are built and
# before starting your production server. # before starting your production server.
config :podcast_feed, PodcastFeedWeb.Endpoint, config :openpod, OpenpodWeb.Endpoint,
load_from_system_env: true, load_from_system_env: true,
url: [scheme: "https", host: "other-unwilling-barasinga.gigalixirapp.com", port: 443], url: [scheme: "https", host: "other-unwilling-barasinga.gigalixirapp.com", port: 443],
http: [port: {:system, "PORT"}], http: [port: {:system, "PORT"}],
@ -19,7 +19,7 @@ config :podcast_feed, PodcastFeedWeb.Endpoint,
version: Application.spec(:phoenix_distillery, :vsn) version: Application.spec(:phoenix_distillery, :vsn)
# force_ssl: [rewrite_on: [:x_forwarded_proto]] # force_ssl: [rewrite_on: [:x_forwarded_proto]]
config :podcast_feed, config :openpod,
cache_duration: :timer.hours(24) cache_duration: :timer.hours(24)
# Do not print debug messages in production # Do not print debug messages in production
@ -30,7 +30,7 @@ config :logger, level: :info
# To get SSL working, you will need to add the `https` key # To get SSL working, you will need to add the `https` key
# to the previous section and set your `:url` port to 443: # to the previous section and set your `:url` port to 443:
# #
# config :podcast_feed, PodcastFeedWeb.Endpoint, # config :openpod, OpenpodWeb.Endpoint,
# ... # ...
# url: [host: "example.com", port: 443], # url: [host: "example.com", port: 443],
# https: [ # https: [
@ -54,7 +54,7 @@ config :logger, level: :info
# We also recommend setting `force_ssl` in your endpoint, ensuring # We also recommend setting `force_ssl` in your endpoint, ensuring
# no data is ever sent via http, always redirecting to https: # no data is ever sent via http, always redirecting to https:
# #
# config :podcast_feed, PodcastFeedWeb.Endpoint, # config :openpod, OpenpodWeb.Endpoint,
# force_ssl: [hsts: true] # force_ssl: [hsts: true]
# #
# Check `Plug.SSL` for all available options in `force_ssl`. # Check `Plug.SSL` for all available options in `force_ssl`.

View file

@ -4,7 +4,7 @@ secret_key_base = System.fetch_env!("SECRET_KEY_BASE")
application_port = System.fetch_env!("APP_PORT") application_port = System.fetch_env!("APP_PORT")
application_host = System.fetch_env!("APP_HOST") application_host = System.fetch_env!("APP_HOST")
config :podcast_feed, PodcastFeedWeb.Endpoint, config :openpod, OpenpodWeb.Endpoint,
url: [scheme: "http", host: application_host, port: String.to_integer(application_port)], url: [scheme: "http", host: application_host, port: String.to_integer(application_port)],
http: [:inet6, port: String.to_integer(application_port)], http: [:inet6, port: String.to_integer(application_port)],
secret_key_base: secret_key_base secret_key_base: secret_key_base

View file

@ -5,16 +5,16 @@ use Mix.Config
# The MIX_TEST_PARTITION environment variable can be used # The MIX_TEST_PARTITION environment variable can be used
# to provide built-in test partitioning in CI environment. # to provide built-in test partitioning in CI environment.
# Run `mix help test` for more information. # Run `mix help test` for more information.
# config :podcast_feed, PodcastFeed.Repo, # config :openpod, Openpod.Repo,
# username: "postgres", # username: "postgres",
# password: "postgres", # password: "postgres",
# database: "podcast_feed_test#{System.get_env("MIX_TEST_PARTITION")}", # database: "openpod_test#{System.get_env("MIX_TEST_PARTITION")}",
# hostname: "localhost", # hostname: "localhost",
# pool: Ecto.Adapters.SQL.Sandbox # pool: Ecto.Adapters.SQL.Sandbox
# We don't run a server during test. If one is required, # We don't run a server during test. If one is required,
# you can enable the server option below. # you can enable the server option below.
config :podcast_feed, PodcastFeedWeb.Endpoint, config :openpod, OpenpodWeb.Endpoint,
http: [port: 4002], http: [port: 4002],
server: false server: false

View file

@ -1,12 +1,12 @@
defmodule PodcastFeed do defmodule Openpod do
@moduledoc """ @moduledoc """
PodcastFeed keeps the contexts that define your domain Openpod keeps the contexts that define your domain
and business logic. and business logic.
Contexts are also responsible for managing your data, regardless Contexts are also responsible for managing your data, regardless
if it comes from the database, an external API or others. if it comes from the database, an external API or others.
""" """
alias PodcastFeed.Provider.Archive alias Openpod.Provider.Archive
def archive(identifier) do def archive(identifier) do
Archive.Parser.by_identifier(identifier) Archive.Parser.by_identifier(identifier)

View file

@ -1,4 +1,4 @@
defmodule PodcastFeed.Application do defmodule Openpod.Application do
# See https://hexdocs.pm/elixir/Application.html # See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications # for more information on OTP Applications
@moduledoc false @moduledoc false
@ -15,25 +15,25 @@ defmodule PodcastFeed.Application do
# Start the dynamic supervisor in order to dynamically start podcast cache # Start the dynamic supervisor in order to dynamically start podcast cache
{DynamicSupervisor, [name: @archive_supervisor, strategy: :one_for_one]}, {DynamicSupervisor, [name: @archive_supervisor, strategy: :one_for_one]},
# Start the Telemetry supervisor # Start the Telemetry supervisor
PodcastFeedWeb.Telemetry, OpenpodWeb.Telemetry,
# Start the PubSub system # Start the PubSub system
{Phoenix.PubSub, name: PodcastFeed.PubSub}, {Phoenix.PubSub, name: Openpod.PubSub},
# Start the Endpoint (http/https) # Start the Endpoint (http/https)
PodcastFeedWeb.Endpoint OpenpodWeb.Endpoint
# Start a worker by calling: PodcastFeed.Worker.start_link(arg) # Start a worker by calling: Openpod.Worker.start_link(arg)
# {PodcastFeed.Worker, arg} # {Openpod.Worker, arg}
] ]
# See https://hexdocs.pm/elixir/Supervisor.html # See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options # for other strategies and supported options
opts = [strategy: :one_for_one, name: PodcastFeed.Supervisor] opts = [strategy: :one_for_one, name: Openpod.Supervisor]
Supervisor.start_link(children, opts) Supervisor.start_link(children, opts)
end end
# Tell Phoenix to update the endpoint configuration # Tell Phoenix to update the endpoint configuration
# whenever the application is updated. # whenever the application is updated.
def config_change(changed, _new, removed) do def config_change(changed, _new, removed) do
PodcastFeedWeb.Endpoint.config_change(changed, removed) OpenpodWeb.Endpoint.config_change(changed, removed)
:ok :ok
end end
end end

View file

@ -1,10 +1,10 @@
defmodule PodcastFeed.Boundary.ArchiveServer do defmodule Openpod.Boundary.ArchiveServer do
@moduledoc false @moduledoc false
use GenServer, restart: :temporary use GenServer, restart: :temporary
require Logger require Logger
alias PodcastFeed alias Openpod
alias PodcastFeed.Provider.Archive alias Openpod.Provider.Archive
@registry :podcast_registry @registry :podcast_registry
@archive_supervisor :archive_supervisor @archive_supervisor :archive_supervisor
@ -44,7 +44,7 @@ defmodule PodcastFeed.Boundary.ArchiveServer do
def handle_call(:get_feed, _from, feed) do def handle_call(:get_feed, _from, feed) do
Logger.debug "retrieve cached feed data for #{feed[:identifier]}..." Logger.debug "retrieve cached feed data for #{feed[:identifier]}..."
{:reply, feed[:feed_data], feed, Application.fetch_env!(:podcast_feed, :cache_duration)} {:reply, feed[:feed_data], feed, Application.fetch_env!(:openpod, :cache_duration)}
end end
def handle_call(:reload, _from, feed) do def handle_call(:reload, _from, feed) do

View file

@ -1,10 +1,10 @@
defmodule PodcastFeed.Provider.Archive.Parser do defmodule Openpod.Provider.Archive.Parser do
@moduledoc """ @moduledoc """
This module provides a public API for fetching data from archive.org and convert them This module provides a public API for fetching data from archive.org and convert them
in a common podcast data structures. in a common podcast data structures.
""" """
alias PodcastFeed.Utility.Format alias Openpod.Utility.Format
alias __MODULE__ alias __MODULE__
@archive_metadata_url "http://archive.org/metadata/{identifier}" @archive_metadata_url "http://archive.org/metadata/{identifier}"
@ -29,10 +29,10 @@ defmodule PodcastFeed.Provider.Archive.Parser do
def by_identifier(identifier) do def by_identifier(identifier) do
%Parser{identifier: identifier} %Parser{identifier: identifier}
|> enrich_with_archive_metadata() |> enrich_with_archive_metadata()
|> to_podcast_feed_data() |> to_openpod_data()
end end
def to_podcast_feed_data(token) do def to_openpod_data(token) do
%{ %{
podcast: podcast_data(token), podcast: podcast_data(token),
items: items_data(token) items: items_data(token)

View file

@ -1,4 +1,4 @@
defmodule PodcastFeed.Utility.Format do defmodule Openpod.Utility.Format do
@moduledoc """ @moduledoc """
This module provides utility to format a string This module provides utility to format a string
""" """

View file

@ -1,12 +1,12 @@
defmodule PodcastFeedWeb do defmodule OpenpodWeb do
@moduledoc """ @moduledoc """
The entrypoint for defining your web interface, such The entrypoint for defining your web interface, such
as controllers, views, channels and so on. as controllers, views, channels and so on.
This can be used in your application as: This can be used in your application as:
use PodcastFeedWeb, :controller use OpenpodWeb, :controller
use PodcastFeedWeb, :view use OpenpodWeb, :view
The definitions below will be executed for every view, The definitions below will be executed for every view,
controller, etc, so keep them short and clean, focused controller, etc, so keep them short and clean, focused
@ -19,19 +19,19 @@ defmodule PodcastFeedWeb do
def controller do def controller do
quote do quote do
use Phoenix.Controller, namespace: PodcastFeedWeb use Phoenix.Controller, namespace: OpenpodWeb
import Plug.Conn import Plug.Conn
import PodcastFeedWeb.Gettext import OpenpodWeb.Gettext
alias PodcastFeedWeb.Router.Helpers, as: Routes alias OpenpodWeb.Router.Helpers, as: Routes
end end
end end
def view do def view do
quote do quote do
use Phoenix.View, use Phoenix.View,
root: "lib/podcast_feed_web/templates", root: "lib/openpod_web/templates",
namespace: PodcastFeedWeb namespace: OpenpodWeb
# Import convenience functions from controllers # Import convenience functions from controllers
import Phoenix.Controller, import Phoenix.Controller,
@ -54,7 +54,7 @@ defmodule PodcastFeedWeb do
def channel do def channel do
quote do quote do
use Phoenix.Channel use Phoenix.Channel
import PodcastFeedWeb.Gettext import OpenpodWeb.Gettext
end end
end end
@ -66,9 +66,9 @@ defmodule PodcastFeedWeb do
# Import basic rendering functionality (render, render_layout, etc) # Import basic rendering functionality (render, render_layout, etc)
import Phoenix.View import Phoenix.View
import PodcastFeedWeb.ErrorHelpers import OpenpodWeb.ErrorHelpers
import PodcastFeedWeb.Gettext import OpenpodWeb.Gettext
alias PodcastFeedWeb.Router.Helpers, as: Routes alias OpenpodWeb.Router.Helpers, as: Routes
end end
end end

View file

@ -1,8 +1,8 @@
defmodule PodcastFeedWeb.UserSocket do defmodule OpenpodWeb.UserSocket do
use Phoenix.Socket use Phoenix.Socket
## Channels ## Channels
# channel "room:*", PodcastFeedWeb.RoomChannel # channel "room:*", OpenpodWeb.RoomChannel
# Socket params are passed from the client and can # Socket params are passed from the client and can
# be used to verify and authenticate a user. After # be used to verify and authenticate a user. After
@ -27,7 +27,7 @@ defmodule PodcastFeedWeb.UserSocket do
# Would allow you to broadcast a "disconnect" event and terminate # Would allow you to broadcast a "disconnect" event and terminate
# all active sockets and channels for a given user: # all active sockets and channels for a given user:
# #
# PodcastFeedWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{}) # OpenpodWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
# #
# Returning `nil` makes this socket anonymous. # Returning `nil` makes this socket anonymous.
@impl true @impl true

View file

@ -1,6 +1,6 @@
defmodule PodcastFeedWeb.FeedController do defmodule OpenpodWeb.FeedController do
use PodcastFeedWeb, :controller use OpenpodWeb, :controller
alias PodcastFeed.Boundary.ArchiveServer alias Openpod.Boundary.ArchiveServer
def by_identifier(conn, %{"identifier" => identifier, "reload" => _}) do def by_identifier(conn, %{"identifier" => identifier, "reload" => _}) do
do_by_identifier(conn, identifier, fn -> ArchiveServer.reload(identifier) end) do_by_identifier(conn, identifier, fn -> ArchiveServer.reload(identifier) end)

View file

@ -0,0 +1,7 @@
defmodule OpenpodWeb.PageController do
use OpenpodWeb, :controller
def index(conn, _params) do
render(conn, "index.html")
end
end

View file

@ -1,16 +1,16 @@
defmodule PodcastFeedWeb.Endpoint do defmodule OpenpodWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :podcast_feed use Phoenix.Endpoint, otp_app: :openpod
# The session will be stored in the cookie and signed, # The session will be stored in the cookie and signed,
# this means its contents can be read but not tampered with. # this means its contents can be read but not tampered with.
# Set :encryption_salt if you would also like to encrypt it. # Set :encryption_salt if you would also like to encrypt it.
@session_options [ @session_options [
store: :cookie, store: :cookie,
key: "_podcast_feed_key", key: "_openpod_key",
signing_salt: "kxzln5AX" signing_salt: "kxzln5AX"
] ]
socket "/socket", PodcastFeedWeb.UserSocket, socket "/socket", OpenpodWeb.UserSocket,
websocket: true, websocket: true,
longpoll: false longpoll: false
@ -22,7 +22,7 @@ defmodule PodcastFeedWeb.Endpoint do
# when deploying your static files in production. # when deploying your static files in production.
plug Plug.Static, plug Plug.Static,
at: "/", at: "/",
from: :podcast_feed, from: :openpod,
gzip: false, gzip: false,
only: ~w(css fonts images js favicon.ico robots.txt) only: ~w(css fonts images js favicon.ico robots.txt)
@ -32,7 +32,7 @@ defmodule PodcastFeedWeb.Endpoint do
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
plug Phoenix.LiveReloader plug Phoenix.LiveReloader
plug Phoenix.CodeReloader plug Phoenix.CodeReloader
# plug Phoenix.Ecto.CheckRepoStatus, otp_app: :podcast_feed # plug Phoenix.Ecto.CheckRepoStatus, otp_app: :openpod
end end
plug Phoenix.LiveDashboard.RequestLogger, plug Phoenix.LiveDashboard.RequestLogger,
@ -50,5 +50,5 @@ defmodule PodcastFeedWeb.Endpoint do
plug Plug.MethodOverride plug Plug.MethodOverride
plug Plug.Head plug Plug.Head
plug Plug.Session, @session_options plug Plug.Session, @session_options
plug PodcastFeedWeb.Router plug OpenpodWeb.Router
end end

View file

@ -1,11 +1,11 @@
defmodule PodcastFeedWeb.Gettext do defmodule OpenpodWeb.Gettext do
@moduledoc """ @moduledoc """
A module providing Internationalization with a gettext-based API. A module providing Internationalization with a gettext-based API.
By using [Gettext](https://hexdocs.pm/gettext), By using [Gettext](https://hexdocs.pm/gettext),
your module gains a set of macros for translations, for example: your module gains a set of macros for translations, for example:
import PodcastFeedWeb.Gettext import OpenpodWeb.Gettext
# Simple translation # Simple translation
gettext("Here is the string to translate") gettext("Here is the string to translate")
@ -20,5 +20,5 @@ defmodule PodcastFeedWeb.Gettext do
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
""" """
use Gettext, otp_app: :podcast_feed use Gettext, otp_app: :openpod
end end

View file

@ -1,5 +1,5 @@
defmodule PodcastFeedWeb.Router do defmodule OpenpodWeb.Router do
use PodcastFeedWeb, :router use OpenpodWeb, :router
pipeline :browser do pipeline :browser do
plug :accepts, ["html"] plug :accepts, ["html"]
@ -13,14 +13,14 @@ defmodule PodcastFeedWeb.Router do
plug :accepts, ["json"] plug :accepts, ["json"]
end end
scope "/podcast", PodcastFeedWeb do scope "/podcast", OpenpodWeb do
pipe_through :browser pipe_through :browser
get "/:identifier", FeedController, :by_identifier get "/:identifier", FeedController, :by_identifier
end end
# Other scopes may use custom stacks. # Other scopes may use custom stacks.
# scope "/api", PodcastFeedWeb do # scope "/api", OpenpodWeb do
# pipe_through :api # pipe_through :api
# end # end
@ -36,7 +36,7 @@ defmodule PodcastFeedWeb.Router do
scope "/" do scope "/" do
pipe_through :browser pipe_through :browser
live_dashboard "/dashboard", metrics: PodcastFeedWeb.Telemetry live_dashboard "/dashboard", metrics: OpenpodWeb.Telemetry
end end
end end
end end

View file

@ -1,4 +1,4 @@
defmodule PodcastFeedWeb.Telemetry do defmodule OpenpodWeb.Telemetry do
use Supervisor use Supervisor
import Telemetry.Metrics import Telemetry.Metrics
@ -31,11 +31,11 @@ defmodule PodcastFeedWeb.Telemetry do
), ),
# Database Metrics # Database Metrics
summary("podcast_feed.repo.query.total_time", unit: {:native, :millisecond}), summary("openpod.repo.query.total_time", unit: {:native, :millisecond}),
summary("podcast_feed.repo.query.decode_time", unit: {:native, :millisecond}), summary("openpod.repo.query.decode_time", unit: {:native, :millisecond}),
summary("podcast_feed.repo.query.query_time", unit: {:native, :millisecond}), summary("openpod.repo.query.query_time", unit: {:native, :millisecond}),
summary("podcast_feed.repo.query.queue_time", unit: {:native, :millisecond}), summary("openpod.repo.query.queue_time", unit: {:native, :millisecond}),
summary("podcast_feed.repo.query.idle_time", unit: {:native, :millisecond}), summary("openpod.repo.query.idle_time", unit: {:native, :millisecond}),
# VM Metrics # VM Metrics
summary("vm.memory.total", unit: {:byte, :kilobyte}), summary("vm.memory.total", unit: {:byte, :kilobyte}),
@ -49,7 +49,7 @@ defmodule PodcastFeedWeb.Telemetry do
[ [
# A module, function and arguments to be invoked periodically. # A module, function and arguments to be invoked periodically.
# This function must call :telemetry.execute/3 and a metric must be added above. # This function must call :telemetry.execute/3 and a metric must be added above.
# {PodcastFeedWeb, :count_users, []} # {OpenpodWeb, :count_users, []}
] ]
end end
end end

View file

@ -21,7 +21,7 @@
<itunes:keywords><%= @podcast.keywords |> Enum.join(", ") %></itunes:keywords> <itunes:keywords><%= @podcast.keywords |> Enum.join(", ") %></itunes:keywords>
<itunes:explicit><![CDATA[<%= @podcast.explicit %>]]></itunes:explicit> <itunes:explicit><![CDATA[<%= @podcast.explicit %>]]></itunes:explicit>
<itunes:image href="<%= @podcast.image.url %>" /> <itunes:image href="<%= @podcast.image.url %>" />
<atom:link href="<%= PodcastFeedWeb.Endpoint.url <> Routes.feed_path(@conn, :by_identifier, @identifier) %>" rel="self" type="application/rss+xml" /> <atom:link href="<%= OpenpodWeb.Endpoint.url <> Routes.feed_path(@conn, :by_identifier, @identifier) %>" rel="self" type="application/rss+xml" />
<pubDate><%= @podcast.pubDate |> Calendar.DateTime.Format.rfc2822 %></pubDate> <pubDate><%= @podcast.pubDate |> Calendar.DateTime.Format.rfc2822 %></pubDate>
<title><![CDATA[<%= @podcast.title %>]]></title> <title><![CDATA[<%= @podcast.title %>]]></title>
<itunes:author><![CDATA[<%= @podcast.owner.name %>]]></itunes:author> <itunes:author><![CDATA[<%= @podcast.owner.name %>]]></itunes:author>

View file

@ -4,7 +4,7 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>PodcastFeed · Phoenix Framework</title> <title>Openpod · Phoenix Framework</title>
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/> <link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
<script defer type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script> <script defer type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
</head> </head>

View file

@ -1,4 +1,4 @@
defmodule PodcastFeedWeb.ErrorHelpers do defmodule OpenpodWeb.ErrorHelpers do
@moduledoc """ @moduledoc """
Conveniences for translating and building error messages. Conveniences for translating and building error messages.
""" """
@ -39,9 +39,9 @@ defmodule PodcastFeedWeb.ErrorHelpers do
# should be written to the errors.po file. The :count option is # should be written to the errors.po file. The :count option is
# set by Ecto and indicates we should also apply plural rules. # set by Ecto and indicates we should also apply plural rules.
if count = opts[:count] do if count = opts[:count] do
Gettext.dngettext(PodcastFeedWeb.Gettext, "errors", msg, msg, count, opts) Gettext.dngettext(OpenpodWeb.Gettext, "errors", msg, msg, count, opts)
else else
Gettext.dgettext(PodcastFeedWeb.Gettext, "errors", msg, opts) Gettext.dgettext(OpenpodWeb.Gettext, "errors", msg, opts)
end end
end end
end end

View file

@ -1,5 +1,5 @@
defmodule PodcastFeedWeb.ErrorView do defmodule OpenpodWeb.ErrorView do
use PodcastFeedWeb, :view use OpenpodWeb, :view
# If you want to customize a particular status code # If you want to customize a particular status code
# for a certain format, you may uncomment below. # for a certain format, you may uncomment below.

View file

@ -1,5 +1,5 @@
defmodule PodcastFeedWeb.FeedView do defmodule OpenpodWeb.FeedView do
use PodcastFeedWeb, :view use OpenpodWeb, :view
def format_length(length) do def format_length(length) do
min = length / 60 |> trunc() min = length / 60 |> trunc()

View file

@ -0,0 +1,3 @@
defmodule OpenpodWeb.LayoutView do
use OpenpodWeb, :view
end

View file

@ -0,0 +1,3 @@
defmodule OpenpodWeb.PageView do
use OpenpodWeb, :view
end

View file

@ -1,7 +0,0 @@
defmodule PodcastFeedWeb.PageController do
use PodcastFeedWeb, :controller
def index(conn, _params) do
render(conn, "index.html")
end
end

View file

@ -1,3 +0,0 @@
defmodule PodcastFeedWeb.LayoutView do
use PodcastFeedWeb, :view
end

View file

@ -1,3 +0,0 @@
defmodule PodcastFeedWeb.PageView do
use PodcastFeedWeb, :view
end

View file

@ -1,9 +1,9 @@
defmodule PodcastFeed.MixProject do defmodule Openpod.MixProject do
use Mix.Project use Mix.Project
def project do def project do
[ [
app: :podcast_feed, app: :openpod,
version: "0.1.0", version: "0.1.0",
elixir: "~> 1.10", elixir: "~> 1.10",
elixirc_paths: elixirc_paths(Mix.env()), elixirc_paths: elixirc_paths(Mix.env()),
@ -21,7 +21,7 @@ defmodule PodcastFeed.MixProject do
# Type `mix help compile.app` for more information. # Type `mix help compile.app` for more information.
def application do def application do
[ [
mod: {PodcastFeed.Application, []}, mod: {Openpod.Application, []},
extra_applications: [:logger, :runtime_tools, :elixir_xml_to_map] extra_applications: [:logger, :runtime_tools, :elixir_xml_to_map]
] ]
end end

View file

@ -5,7 +5,7 @@
# Inside the script, you can read and write to any of your # Inside the script, you can read and write to any of your
# repositories directly: # repositories directly:
# #
# PodcastFeed.Repo.insert!(%PodcastFeed.SomeSchema{}) # Openpod.Repo.insert!(%Openpod.SomeSchema{})
# #
# We recommend using the bang functions (`insert!`, `update!` # We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if something goes wrong. # and so on) as they will fail if something goes wrong.

View file

@ -1,7 +1,7 @@
defmodule PodcastFeed.Provider.Archive.ParserTest do defmodule Openpod.Provider.Archive.ParserTest do
use ExUnit.Case use ExUnit.Case
alias PodcastFeed.Provider.Archive.Parser alias Openpod.Provider.Archive.Parser
setup_all do setup_all do
json_metadata = "{\"created\":1590247789,\"d1\":\"ia601402.us.archive.org\",\"d2\":\"ia801402.us.archive.org\",\"dir\":\"/8/items/incontri-a-piano-terra\",\"files\":[{\"name\": \"metadata.json\",\"source\": \"original\",\"mtime\": \"1590258296\",\"size\": \"315\",\"md5\": \"a0c0e219cf3f13e54f2a4b3efef8e5c8\",\"crc32\": \"2d181b5c\",\"sha1\": \"8244b579a759edddd01c905dd11f8565e83d0898\",\"format\": \"JSON\"},{\"name\": \"cover.jpg\",\"source\": \"original\",\"mtime\": \"1590258445\",\"size\": \"10650\",\"md5\": \"15687b23e11f0099abbfe64eb1685c31\",\"crc32\": \"fbb1516a\",\"sha1\": \"98fa929c7554241cfa92bea8eba69b39c5d47603\",\"format\": \"JPEG\",\"rotation\": \"0\"},{\"name\":\"Confini mobili sulle alpi.mp3\",\"source\":\"original\",\"mtime\":\"1590135989\",\"size\":\"46933494\",\"md5\":\"e832ee9381a4f8af2d9727e2f49126ae\",\"crc32\":\"d709dd90\",\"sha1\":\"89c820a2dfd63cfbbf7aeefd191c653756b33fe3\",\"format\":\"VBR MP3\",\"length\":\"3902.35\",\"height\":\"0\",\"width\":\"0\",\"title\":\"Confini mobili sulle alpi (italian limes)\",\"creator\":\"APE Milano\",\"album\":\"Incontri a Piano Terra\",\"track\":\"02\",\"artist\":\"APE Milano\",\"genre\":\"podcast\"},{\"name\":\"Confini mobili sulle alpi.png\",\"source\":\"derivative\",\"format\":\"PNG\",\"original\":\"Confini mobili sulle alpi.mp3\",\"mtime\":\"1590137809\",\"size\":\"34656\",\"md5\":\"63893f9b00402a107682b5317e808523\",\"crc32\":\"b59ff609\",\"sha1\":\"a396716431cd0acedd243030093d0b31d792cfb3\"},{\"name\":\"Confini mobili sulle alpi_spectrogram.png\",\"source\":\"derivative\",\"format\":\"Spectrogram\",\"original\":\"Confini mobili sulle alpi.mp3\",\"mtime\":\"1590137854\",\"size\":\"273188\",\"md5\":\"557337665c6d9f962b2e91d169f25e1b\",\"crc32\":\"08b4b57c\",\"sha1\":\"88e088f9c4954aa8f0849b7e0d69cee8d7d42327\"}],\"files_count\":31,\"item_last_updated\":1590160774,\"item_size\":244544362,\"metadata\":{\"identifier\":\"incontri-a-piano-terra\",\"mediatype\":\"audio\",\"collection\":\"opensource_audio\",\"creator\":\"APE Milano\",\"description\":\"Qualche registrazione delle attivit\\u00e0 sociali che promuoviamo al Piano Terra di Milano\",\"language\":\"ita\",\"licenseurl\":\"https://creativecommons.org/licenses/by-nc-nd/4.0/\",\"scanner\":\"Internet Archive HTML5 Uploader 1.6.4\",\"subject\":[\"ape milano\",\"podcast\",\"montagna\"],\"title\":\"Incontri a Piano Terra\",\"uploader\":\"milanoape@gmail.com\",\"publicdate\":\"2020-05-22 08:30:21\",\"addeddate\":\"2020-05-22 08:30:21\",\"curation\":\"[curator]validator@archive.org[/curator][date]20200522085526[/date][comment]checked for malware[/comment]\",\"op_link\":\"http://www.ape-alveare.it/\",\"op_category\":\"Montagna\",\"op_explicit\":\"no\"},\"server\":\"ia601402.us.archive.org\",\"uniq\":122833277,\"workable_servers\":[\"ia601402.us.archive.org\",\"ia801402.us.archive.org\"]}" json_metadata = "{\"created\":1590247789,\"d1\":\"ia601402.us.archive.org\",\"d2\":\"ia801402.us.archive.org\",\"dir\":\"/8/items/incontri-a-piano-terra\",\"files\":[{\"name\": \"metadata.json\",\"source\": \"original\",\"mtime\": \"1590258296\",\"size\": \"315\",\"md5\": \"a0c0e219cf3f13e54f2a4b3efef8e5c8\",\"crc32\": \"2d181b5c\",\"sha1\": \"8244b579a759edddd01c905dd11f8565e83d0898\",\"format\": \"JSON\"},{\"name\": \"cover.jpg\",\"source\": \"original\",\"mtime\": \"1590258445\",\"size\": \"10650\",\"md5\": \"15687b23e11f0099abbfe64eb1685c31\",\"crc32\": \"fbb1516a\",\"sha1\": \"98fa929c7554241cfa92bea8eba69b39c5d47603\",\"format\": \"JPEG\",\"rotation\": \"0\"},{\"name\":\"Confini mobili sulle alpi.mp3\",\"source\":\"original\",\"mtime\":\"1590135989\",\"size\":\"46933494\",\"md5\":\"e832ee9381a4f8af2d9727e2f49126ae\",\"crc32\":\"d709dd90\",\"sha1\":\"89c820a2dfd63cfbbf7aeefd191c653756b33fe3\",\"format\":\"VBR MP3\",\"length\":\"3902.35\",\"height\":\"0\",\"width\":\"0\",\"title\":\"Confini mobili sulle alpi (italian limes)\",\"creator\":\"APE Milano\",\"album\":\"Incontri a Piano Terra\",\"track\":\"02\",\"artist\":\"APE Milano\",\"genre\":\"podcast\"},{\"name\":\"Confini mobili sulle alpi.png\",\"source\":\"derivative\",\"format\":\"PNG\",\"original\":\"Confini mobili sulle alpi.mp3\",\"mtime\":\"1590137809\",\"size\":\"34656\",\"md5\":\"63893f9b00402a107682b5317e808523\",\"crc32\":\"b59ff609\",\"sha1\":\"a396716431cd0acedd243030093d0b31d792cfb3\"},{\"name\":\"Confini mobili sulle alpi_spectrogram.png\",\"source\":\"derivative\",\"format\":\"Spectrogram\",\"original\":\"Confini mobili sulle alpi.mp3\",\"mtime\":\"1590137854\",\"size\":\"273188\",\"md5\":\"557337665c6d9f962b2e91d169f25e1b\",\"crc32\":\"08b4b57c\",\"sha1\":\"88e088f9c4954aa8f0849b7e0d69cee8d7d42327\"}],\"files_count\":31,\"item_last_updated\":1590160774,\"item_size\":244544362,\"metadata\":{\"identifier\":\"incontri-a-piano-terra\",\"mediatype\":\"audio\",\"collection\":\"opensource_audio\",\"creator\":\"APE Milano\",\"description\":\"Qualche registrazione delle attivit\\u00e0 sociali che promuoviamo al Piano Terra di Milano\",\"language\":\"ita\",\"licenseurl\":\"https://creativecommons.org/licenses/by-nc-nd/4.0/\",\"scanner\":\"Internet Archive HTML5 Uploader 1.6.4\",\"subject\":[\"ape milano\",\"podcast\",\"montagna\"],\"title\":\"Incontri a Piano Terra\",\"uploader\":\"milanoape@gmail.com\",\"publicdate\":\"2020-05-22 08:30:21\",\"addeddate\":\"2020-05-22 08:30:21\",\"curation\":\"[curator]validator@archive.org[/curator][date]20200522085526[/date][comment]checked for malware[/comment]\",\"op_link\":\"http://www.ape-alveare.it/\",\"op_category\":\"Montagna\",\"op_explicit\":\"no\"},\"server\":\"ia601402.us.archive.org\",\"uniq\":122833277,\"workable_servers\":[\"ia601402.us.archive.org\",\"ia801402.us.archive.org\"]}"
@ -15,7 +15,7 @@ defmodule PodcastFeed.Provider.Archive.ParserTest do
end end
test "podcast data are correctly converted", state do test "podcast data are correctly converted", state do
%{podcast: podcast} = Parser.to_podcast_feed_data(state[:token]) %{podcast: podcast} = Parser.to_openpod_data(state[:token])
assert %{ assert %{
title: "Incontri a Piano Terra", title: "Incontri a Piano Terra",
@ -44,7 +44,7 @@ defmodule PodcastFeed.Provider.Archive.ParserTest do
test "podcast subject metadata can also be a string", state do test "podcast subject metadata can also be a string", state do
token = state[:token] |> Map.update!(:archive_metadata, fn metadata -> put_in(metadata, ["metadata", "subject"], "foo;bar;baz") end) token = state[:token] |> Map.update!(:archive_metadata, fn metadata -> put_in(metadata, ["metadata", "subject"], "foo;bar;baz") end)
%{podcast: podcast} = Parser.to_podcast_feed_data(token) %{podcast: podcast} = Parser.to_openpod_data(token)
assert %{ assert %{
keywords: ["foo", "bar", "baz"], keywords: ["foo", "bar", "baz"],
@ -52,7 +52,7 @@ defmodule PodcastFeed.Provider.Archive.ParserTest do
end end
test "items data are correctly converted", state do test "items data are correctly converted", state do
%{items: items} = Parser.to_podcast_feed_data(state[:token]) %{items: items} = Parser.to_openpod_data(state[:token])
assert [ assert [
%{ %{

View file

@ -1,7 +1,7 @@
defmodule PodcastFeed.Utility.FormatTest do defmodule Openpod.Utility.FormatTest do
use ExUnit.Case use ExUnit.Case
alias PodcastFeed.Utility.Format alias Openpod.Utility.Format
test "Test placeholder are replaced" do test "Test placeholder are replaced" do
assert "http://foo/bar" == Format.compile("http://{host}/{path}", host: "foo", path: "bar") assert "http://foo/bar" == Format.compile("http://{host}/{path}", host: "foo", path: "bar")

View file

@ -1,5 +1,5 @@
defmodule PodcastFeedWeb.PageControllerTest do defmodule OpenpodWeb.PageControllerTest do
use PodcastFeedWeb.ConnCase use OpenpodWeb.ConnCase
# test "GET /", %{conn: conn} do # test "GET /", %{conn: conn} do
# conn = get(conn, "/") # conn = get(conn, "/")

View file

@ -0,0 +1,14 @@
defmodule OpenpodWeb.ErrorViewTest do
use OpenpodWeb.ConnCase, async: true
# Bring render/3 and render_to_string/3 for testing custom views
import Phoenix.View
test "renders 404.html" do
assert render_to_string(OpenpodWeb.ErrorView, "404.html", []) == "Not Found"
end
test "renders 500.html" do
assert render_to_string(OpenpodWeb.ErrorView, "500.html", []) == "Internal Server Error"
end
end

View file

@ -1,5 +1,5 @@
defmodule PodcastFeedWeb.LayoutViewTest do defmodule OpenpodWeb.LayoutViewTest do
use PodcastFeedWeb.ConnCase, async: true use OpenpodWeb.ConnCase, async: true
# When testing helpers, you may want to import Phoenix.HTML and # When testing helpers, you may want to import Phoenix.HTML and
# use functions such as safe_to_string() to convert the helper # use functions such as safe_to_string() to convert the helper

View file

@ -0,0 +1,3 @@
defmodule OpenpodWeb.PageViewTest do
use OpenpodWeb.ConnCase, async: true
end

View file

@ -1,14 +0,0 @@
defmodule PodcastFeedWeb.ErrorViewTest do
use PodcastFeedWeb.ConnCase, async: true
# Bring render/3 and render_to_string/3 for testing custom views
import Phoenix.View
test "renders 404.html" do
assert render_to_string(PodcastFeedWeb.ErrorView, "404.html", []) == "Not Found"
end
test "renders 500.html" do
assert render_to_string(PodcastFeedWeb.ErrorView, "500.html", []) == "Internal Server Error"
end
end

View file

@ -1,3 +0,0 @@
defmodule PodcastFeedWeb.PageViewTest do
use PodcastFeedWeb.ConnCase, async: true
end

View file

@ -1,4 +1,4 @@
defmodule PodcastFeedWeb.ChannelCase do defmodule OpenpodWeb.ChannelCase do
@moduledoc """ @moduledoc """
This module defines the test case to be used by This module defines the test case to be used by
channel tests. channel tests.
@ -11,7 +11,7 @@ defmodule PodcastFeedWeb.ChannelCase do
we enable the SQL sandbox, so changes done to the database we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously PostgreSQL, you can even run database tests asynchronously
by setting `use PodcastFeedWeb.ChannelCase, async: true`, although by setting `use OpenpodWeb.ChannelCase, async: true`, although
this option is not recommended for other databases. this option is not recommended for other databases.
""" """
@ -21,18 +21,18 @@ defmodule PodcastFeedWeb.ChannelCase do
quote do quote do
# Import conveniences for testing with channels # Import conveniences for testing with channels
import Phoenix.ChannelTest import Phoenix.ChannelTest
import PodcastFeedWeb.ChannelCase import OpenpodWeb.ChannelCase
# The default endpoint for testing # The default endpoint for testing
@endpoint PodcastFeedWeb.Endpoint @endpoint OpenpodWeb.Endpoint
end end
end end
setup tags do setup tags do
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(PodcastFeed.Repo) # :ok = Ecto.Adapters.SQL.Sandbox.checkout(Openpod.Repo)
# unless tags[:async] do # unless tags[:async] do
# Ecto.Adapters.SQL.Sandbox.mode(PodcastFeed.Repo, {:shared, self()}) # Ecto.Adapters.SQL.Sandbox.mode(Openpod.Repo, {:shared, self()})
# end # end
:ok :ok

View file

@ -1,4 +1,4 @@
defmodule PodcastFeedWeb.ConnCase do defmodule OpenpodWeb.ConnCase do
@moduledoc """ @moduledoc """
This module defines the test case to be used by This module defines the test case to be used by
tests that require setting up a connection. tests that require setting up a connection.
@ -11,7 +11,7 @@ defmodule PodcastFeedWeb.ConnCase do
we enable the SQL sandbox, so changes done to the database we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously PostgreSQL, you can even run database tests asynchronously
by setting `use PodcastFeedWeb.ConnCase, async: true`, although by setting `use OpenpodWeb.ConnCase, async: true`, although
this option is not recommended for other databases. this option is not recommended for other databases.
""" """
@ -22,20 +22,20 @@ defmodule PodcastFeedWeb.ConnCase do
# Import conveniences for testing with connections # Import conveniences for testing with connections
import Plug.Conn import Plug.Conn
import Phoenix.ConnTest import Phoenix.ConnTest
import PodcastFeedWeb.ConnCase import OpenpodWeb.ConnCase
alias PodcastFeedWeb.Router.Helpers, as: Routes alias OpenpodWeb.Router.Helpers, as: Routes
# The default endpoint for testing # The default endpoint for testing
@endpoint PodcastFeedWeb.Endpoint @endpoint OpenpodWeb.Endpoint
end end
end end
setup tags do setup tags do
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(PodcastFeed.Repo) # :ok = Ecto.Adapters.SQL.Sandbox.checkout(Openpod.Repo)
# unless tags[:async] do # unless tags[:async] do
# Ecto.Adapters.SQL.Sandbox.mode(PodcastFeed.Repo, {:shared, self()}) # Ecto.Adapters.SQL.Sandbox.mode(Openpod.Repo, {:shared, self()})
# end # end
{:ok, conn: Phoenix.ConnTest.build_conn()} {:ok, conn: Phoenix.ConnTest.build_conn()}

View file

@ -1,4 +1,4 @@
defmodule PodcastFeed.DataCase do defmodule Openpod.DataCase do
@moduledoc """ @moduledoc """
This module defines the setup for tests requiring This module defines the setup for tests requiring
access to the application's data layer. access to the application's data layer.
@ -10,7 +10,7 @@ defmodule PodcastFeed.DataCase do
we enable the SQL sandbox, so changes done to the database we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously PostgreSQL, you can even run database tests asynchronously
by setting `use PodcastFeed.DataCase, async: true`, although by setting `use Openpod.DataCase, async: true`, although
this option is not recommended for other databases. this option is not recommended for other databases.
""" """
@ -18,20 +18,20 @@ defmodule PodcastFeed.DataCase do
using do using do
quote do quote do
alias PodcastFeed.Repo alias Openpod.Repo
# import Ecto # import Ecto
# import Ecto.Changeset # import Ecto.Changeset
# import Ecto.Query # import Ecto.Query
import PodcastFeed.DataCase import Openpod.DataCase
end end
end end
setup tags do setup tags do
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(PodcastFeed.Repo) # :ok = Ecto.Adapters.SQL.Sandbox.checkout(Openpod.Repo)
# unless tags[:async] do # unless tags[:async] do
# Ecto.Adapters.SQL.Sandbox.mode(PodcastFeed.Repo, {:shared, self()}) # Ecto.Adapters.SQL.Sandbox.mode(Openpod.Repo, {:shared, self()})
# end # end
:ok :ok

View file

@ -1,2 +1,2 @@
ExUnit.start() ExUnit.start()
# Ecto.Adapters.SQL.Sandbox.mode(PodcastFeed.Repo, :manual) # Ecto.Adapters.SQL.Sandbox.mode(Openpod.Repo, :manual)